I’m using xdg.dataFile in order to install krita plugin, the issue is that krita plugin need to have their content placed in the `~/.local/share/krita/pykrita" and cannot be put in subfolder. For now I’m doing

  xdg.dataFile = {
    "krita/pykrita" = {
      enable = true;
      source = pkgs.fetchFromGitHub {
        owner = "veryprofessionaldodo";
        repo = "Krita-UI-Redesign";
        rev = "df37ade2334b09ca30820286e3e16c26b0fbb4f8";
        hash = "sha256-kGs1K2aNIiQq//W8IQ2JX4iyXq43z2I/WnI8aJjg8Yk=";
      };
      recursive = true;
    };
  };

It’s fine when i use a single plugin, but when a use multiple plugins i gotta use multiple fetchers which im not sure how to do. tried to do source = <fetcher 1> + <fetcher 2> which surprisingly builds but then the home-manager service fails

  • stupiv@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    20 days ago

    pkgs.symlinkJoin might help:

    {pkgs, ...}: let
      plugin1 = pkgs.fetchFromGitHub { ... };
      plugin2 = pkgs.fetchFromGitHub { ... };
    in {
      xdg.dataFile = {
        "krita/pykrita" = {
          enable = true;
          source = pkgs.symlinkJoin {
            name = "pykrita";
            paths = [
              plugin1
              plugin2
            ];
          };
          recursive = true;
        };
      };
    }
    

    You might also want to manage your plugins in separate files:

    # krita-plugins.nix
    {
      config,
      lib,
      pkgs,
      ...
    }:
    with lib; {
      options.yourOptions.krita.plugins = mkOption {
        type = types.listOf types.path;
        default = [];
      };
      config = {
        xdg.dataFile = {
          "krita/pykrita" = {
            enable = true;
            source = pkgs.symlinkJoin {
              name = "pykrita";
              paths = config.yourOptions.krita.plugins;
            };
            recursive = true;
          };
        };
      };
    }
    
    # kirta-plugin-a.nix
    {pkgs, ...}: {
      yourOptions.krita.plugins = [
        (pkgs.fetchFromGitHub { ... })
      ];
    }
    
    # kirta-plugin-b.nix
    {pkgs, ...}: {
      yourOptions.krita.plugins = [
        (pkgs.fetchFromGitHub { ... })
      ];
    }
    
    • claymorwanOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      23 days ago

      o yea this did work, i went with the first snippet but im curious abt what the better thing abt diong it in multiple files

      • stupiv@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        20 days ago

        For instance, it allows the option to be configured in home-manager, while plugins are set via a home-manager option.