9 cfg = config.services.salt.master;
11 fullConfig = lib.recursiveUpdate {
12 # Provide defaults for some directories to allow an immutable config dir
14 # Default is equivalent to /etc/salt/master.d/*.conf
15 default_include = "/var/lib/salt/master.d/*.conf";
16 # Default is in /etc/salt/pki/master
17 pki_dir = "/var/lib/salt/pki/master";
24 services.salt.master = {
25 enable = lib.mkEnableOption "Salt configuration management system master service";
26 configuration = lib.mkOption {
27 type = lib.types.attrs;
29 description = "Salt master configuration as Nix attribute set.";
34 config = lib.mkIf cfg.enable {
36 # Set this up in /etc/salt/master so `salt`, `salt-key`, etc. work.
37 # The alternatives are
38 # - passing --config-dir to all salt commands, not just the master unit,
39 # - setting a global environment variable,
40 etc."salt/master".source = pkgs.writeText "master" (builtins.toJSON fullConfig);
41 systemPackages = with pkgs; [ salt ];
43 systemd.services.salt-master = {
44 description = "Salt Master";
45 wantedBy = [ "multi-user.target" ];
46 after = [ "network.target" ];
48 util-linux # for dmesg
51 ExecStart = "${pkgs.salt}/bin/salt-master";
57 config.environment.etc."salt/master".source
62 meta.maintainers = with lib.maintainers; [ Flakebi ];