Skip to content

Commit 779ae06

Browse files
aneeshusaMic92
authored andcommittedMay 9, 2017
Add salt master module (#25632)
* salt: 2016.11.2 -> 2016.11.4 * salt: Add master NixOS module
1 parent 0d6d47e commit 779ae06

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed
 

‎nixos/modules/module-list.nix

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
./security/rtkit.nix
130130
./security/wrappers/default.nix
131131
./security/sudo.nix
132+
./services/admin/salt/master.nix
132133
./services/amqp/activemq/default.nix
133134
./services/amqp/rabbitmq.nix
134135
./services/audio/alsa.nix
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{ config, pkgs, lib, ... }:
2+
3+
with lib;
4+
5+
let
6+
7+
cfg = config.services.salt.master;
8+
9+
fullConfig = lib.recursiveUpdate {
10+
# Provide defaults for some directories to allow an immutable config dir
11+
12+
# Default is equivalent to /etc/salt/master.d/*.conf
13+
default_include = "/var/lib/salt/master.d/*.conf";
14+
# Default is in /etc/salt/pki/master
15+
pki_dir = "/var/lib/salt/pki/master";
16+
} cfg.configuration;
17+
18+
in
19+
20+
{
21+
options = {
22+
services.salt.master = {
23+
enable = mkEnableOption "Salt master service";
24+
configuration = mkOption {
25+
type = types.attrs;
26+
default = {};
27+
description = "Salt master configuration as Nix attribute set.";
28+
};
29+
};
30+
};
31+
32+
config = mkIf cfg.enable {
33+
environment = {
34+
# Set this up in /etc/salt/master so `salt`, `salt-key`, etc. work.
35+
# The alternatives are
36+
# - passing --config-dir to all salt commands, not just the master unit,
37+
# - setting a global environment variable,
38+
etc."salt/master".source = pkgs.writeText "master" (
39+
builtins.toJSON fullConfig
40+
);
41+
systemPackages = with pkgs; [ salt ];
42+
};
43+
systemd.services.salt-master = {
44+
description = "Salt Master";
45+
wantedBy = [ "multi-user.target" ];
46+
after = [ "network.target" ];
47+
path = with pkgs; [
48+
utillinux # for dmesg
49+
];
50+
serviceConfig = {
51+
ExecStart = "${pkgs.salt}/bin/salt-master";
52+
LimitNOFILE = 16384;
53+
Type = "notify";
54+
NotifyAccess = "all";
55+
};
56+
};
57+
};
58+
59+
meta.maintainers = with lib.maintainers; [ aneeshusa ];
60+
}

‎pkgs/tools/admin/salt/default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
python2Packages.buildPythonApplication rec {
1010
name = "salt-${version}";
11-
version = "2016.11.2";
11+
version = "2016.11.4";
1212

1313
src = fetchurl {
1414
url = "mirror://pypi/s/salt/${name}.tar.gz";
15-
sha256 = "0hrss5x47cr7ffyjl8jlkhf9j88lqvg7c33rjc5bimck8b7x7hzm";
15+
sha256 = "0pvn0pkndwx81xkpah14awz4rg9zhkpl4bhn3hlrin1zinr0jhgv";
1616
};
1717

1818
propagatedBuildInputs = with python2Packages; [

0 commit comments

Comments
 (0)
Please sign in to comment.