From adf826119217c23dc4c52c8da892d30df54b02ad Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sun, 14 May 2017 23:32:45 -0400 Subject: [PATCH 1/3] nixos/salt-minion: Remove trailing whitespace --- nixos/modules/services/admin/salt/minion.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/admin/salt/minion.nix b/nixos/modules/services/admin/salt/minion.nix index 9ecefb32cfa..be2c5e2f83d 100644 --- a/nixos/modules/services/admin/salt/minion.nix +++ b/nixos/modules/services/admin/salt/minion.nix @@ -28,8 +28,8 @@ in default = {}; description = '' Salt minion configuration as Nix attribute set. - See - for details. + See + for details. ''; }; }; From 37c9915340357226d2c9090425e9566feb7bb159 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sun, 14 May 2017 23:29:32 -0400 Subject: [PATCH 2/3] nixos/salt-minion: Fix salt-call without `-c` --- nixos/modules/services/admin/salt/minion.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/admin/salt/minion.nix b/nixos/modules/services/admin/salt/minion.nix index be2c5e2f83d..254ff7bb899 100644 --- a/nixos/modules/services/admin/salt/minion.nix +++ b/nixos/modules/services/admin/salt/minion.nix @@ -15,7 +15,6 @@ let # Default is in /etc/salt/pki/minion pki_dir = "/var/lib/salt/pki/minion"; } cfg.configuration; - configDir = pkgs.writeTextDir "minion" (builtins.toJSON fullConfig); in @@ -36,7 +35,16 @@ in }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ salt ]; + environment = { + # Set this up in /etc/salt/minion so `salt-call`, etc. work. + # The alternatives are + # - passing --config-dir to all salt commands, not just the minion unit, + # - setting aglobal environment variable. + etc."salt/minion".source = pkgs.writeText "minion" ( + builtins.toJSON fullConfig + ); + systemPackages = with pkgs; [ salt ]; + }; systemd.services.salt-minion = { description = "Salt Minion"; wantedBy = [ "multi-user.target" ]; @@ -45,7 +53,7 @@ in utillinux ]; serviceConfig = { - ExecStart = "${pkgs.salt}/bin/salt-minion --config-dir=${configDir}"; + ExecStart = "${pkgs.salt}/bin/salt-minion"; LimitNOFILE = 8192; Type = "notify"; NotifyAccess = "all"; From a962d538068cdf00025e73181d17572492f68008 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Tue, 18 Sep 2018 09:30:22 -0700 Subject: [PATCH 3/3] salt: Restart on config changes --- nixos/modules/services/admin/salt/master.nix | 3 +++ nixos/modules/services/admin/salt/minion.nix | 3 +++ 2 files changed, 6 insertions(+) diff --git a/nixos/modules/services/admin/salt/master.nix b/nixos/modules/services/admin/salt/master.nix index 165580b9783..c6b1b0cc0bd 100644 --- a/nixos/modules/services/admin/salt/master.nix +++ b/nixos/modules/services/admin/salt/master.nix @@ -53,6 +53,9 @@ in Type = "notify"; NotifyAccess = "all"; }; + restartTriggers = [ + config.environment.etc."salt/master".source + ]; }; }; diff --git a/nixos/modules/services/admin/salt/minion.nix b/nixos/modules/services/admin/salt/minion.nix index 254ff7bb899..c8fa9461a20 100644 --- a/nixos/modules/services/admin/salt/minion.nix +++ b/nixos/modules/services/admin/salt/minion.nix @@ -58,6 +58,9 @@ in Type = "notify"; NotifyAccess = "all"; }; + restartTriggers = [ + config.environment.etc."salt/minion".source + ]; }; }; }