diff options
author | Aneesh Agrawal <aneeshusa@gmail.com> | 2017-05-09 13:20:35 -0400 |
---|---|---|
committer | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-05-09 18:20:35 +0100 |
commit | 779ae064674aa9645bcefaacbc83f942e2ef759f (patch) | |
tree | bc2a716ee2239cb7090c994066fae8826cc76a4d /nixos/modules/services/admin | |
parent | 0d6d47edd10ad32d1feb5ee1c7e2d78d68098e99 (diff) |
Add salt master module (#25632)
* salt: 2016.11.2 -> 2016.11.4
* salt: Add master NixOS module
Diffstat (limited to 'nixos/modules/services/admin')
-rw-r--r-- | nixos/modules/services/admin/salt/master.nix | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/nixos/modules/services/admin/salt/master.nix b/nixos/modules/services/admin/salt/master.nix new file mode 100644 index 000000000000..165580b97837 --- /dev/null +++ b/nixos/modules/services/admin/salt/master.nix @@ -0,0 +1,60 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + + cfg = config.services.salt.master; + + fullConfig = lib.recursiveUpdate { + # Provide defaults for some directories to allow an immutable config dir + + # Default is equivalent to /etc/salt/master.d/*.conf + default_include = "/var/lib/salt/master.d/*.conf"; + # Default is in /etc/salt/pki/master + pki_dir = "/var/lib/salt/pki/master"; + } cfg.configuration; + +in + +{ + options = { + services.salt.master = { + enable = mkEnableOption "Salt master service"; + configuration = mkOption { + type = types.attrs; + default = {}; + description = "Salt master configuration as Nix attribute set."; + }; + }; + }; + + config = mkIf cfg.enable { + environment = { + # Set this up in /etc/salt/master so `salt`, `salt-key`, etc. work. + # The alternatives are + # - passing --config-dir to all salt commands, not just the master unit, + # - setting a global environment variable, + etc."salt/master".source = pkgs.writeText "master" ( + builtins.toJSON fullConfig + ); + systemPackages = with pkgs; [ salt ]; + }; + systemd.services.salt-master = { + description = "Salt Master"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + path = with pkgs; [ + utillinux # for dmesg + ]; + serviceConfig = { + ExecStart = "${pkgs.salt}/bin/salt-master"; + LimitNOFILE = 16384; + Type = "notify"; + NotifyAccess = "all"; + }; + }; + }; + + meta.maintainers = with lib.maintainers; [ aneeshusa ]; +} |