Adding packages to salt-master/minion path with overlay

Hi there,
The salt-master and salt-minion service using package salt is a bit crippled because the attribute path contains only references to parts of util-linux. I would like to use for instance git or rsync but that gives errors that salt can’t find the bin files. This is the path of the salt-master service:

Environment="PATH=/nix/store/g3f2i92cihcbbap4fz1x91lsb4yaks1c-util-linux-2.39.2-bin/bin:/nix/store/26zdl4pyw5qazppj8if5lm8bjzxlc07l-coreutils-9.3/bin:/nix/store/sn1hi205k632b3l13dwxdwx4f0mf7ysr-findutils-4.9.0/bin:/nix/store/22fcki4y6mwqah9rmh1d0qh5jiw32y70-gnugrep-3.11/bin:/nix/store/ii9ma4ck06pcb9g3v9hdg8bx9cga4ax3-gnused-4.9/bin:/nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/bin:/nix/store/g3f2i92cihcbbap4fz1x91lsb4yaks1c-util-linux-2.39.2-bin/sbin:/nix/store/26zdl4pyw5qazppj8if5lm8bjzxlc07l-coreutils-9.3/sbin:/nix/store/sn1hi205k632b3l13dwxdwx4f0mf7ysr-findutils-4.9.0/sbin:/nix/store/22fcki4y6mwqah9rmh1d0qh5jiw32y70-gnugrep-3.11/sbin:/nix/store/ii9ma4ck06pcb9g3v9hdg8bx9cga4ax3-gnused-4.9/sbin:/nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/sbin"

I tried to use overlay within the nixos configuration.nix file, I added only the salt-master part:

# Overrides
  nixpkgs.overlays = [
    (final: prev: {
      systemd.services.salt-master = prev.systemd.services.salt-master.override{
        path = with pkgs; [
          util-linux  # for dmesg
          git
          rsync
        ];
      };
    })    
  ];

The nixos-rebuild switch gives errors:

      … while evaluating attribute 'path' of derivation 'nixos-rebuild'

         at /nix/store/wdzp0hmh5lbykyvchd1wihszcyab78qv-nixos-23.11/nixos/pkgs/os-specific/linux/nixos-rebuild/default.nix:25:3:

           24|   nix_aarch64_linux = fallback.aarch64-linux;
           25|   path = lib.makeBinPath [ coreutils gnused gnugrep jq util-linux ];
             |   ^
           26|   nativeBuildInputs = [

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Dependency is not of a valid type: element 6 of buildInputs for util-linux
building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/wdzp0hmh5lbykyvchd1wihszcyab78qv-nixos-23.11/nixos/lib/attrsets.nix:922:11:

          921|         || pred here (elemAt values 1) (head values) then
          922|           head values
             |           ^
          923|         else

       … while evaluating the attribute 'value'

         at /nix/store/wdzp0hmh5lbykyvchd1wihszcyab78qv-nixos-23.11/nixos/lib/modules.nix:807:9:

          806|     in warnDeprecation opt //
          807|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          808|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Dependency is not of a valid type: element 2 of buildInputs for procps

My metadata for nixos is:

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.86, NixOS, 23.11 (Tapir), 23.11.6359.53a2c32bc66f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I would appreciate it if someone looked into it

Hi,

I’m also trying to get Salt working in my environment, found this post, and also the salt package in nixpkgs here: nixpkgs/pkgs/tools/admin/salt/default.nix at 9f4128e00b0ae8ec65918efeba59db998750ead6 · NixOS/nixpkgs · GitHub

… it looks like you can specify extra packages to include for Salt using the “extraInputs” option – but how?

I’m not seeing a configuration option to set this – looking for how to specify additional packages to pass into extraInputs…

Thanks,
John

Hi,

Nice to hear you trying to get Salt working. I’m not familiar with defining “extraInputs”. But could you explain which packages you would like to insert and why it is necessary?

Currently I’m working with a local repository of nixpkgs to change the module definition. This could also be a workaround to add extra packages.