summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-01-24 00:09:45 +0100
committerJan Tojnar <jtojnar@gmail.com>2021-01-24 00:09:45 +0100
commit01ee4ea574a426a5d48cd503163233d13bea050d (patch)
tree8ccca2180720717625a6930efb35c11681968910 /nixos/modules/services
parent58752914f4b22a570ff7cba694df86aef20e255a (diff)
parentf1778cd90eea2c3d5dbca3aa55b6351697dad683 (diff)
Merge branch 'master' into staging-next
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix8
-rw-r--r--nixos/modules/services/networking/nomad.nix25
2 files changed, 24 insertions, 9 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 0eeff31d6c4d..64bdbf159d51 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -587,10 +587,10 @@ in
nix.systemFeatures = mkDefault (
[ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++
- optionals (pkgs.hostPlatform.platform ? gcc.arch) (
- # a builder can run code for `platform.gcc.arch` and inferior architectures
- [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++
- map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch}
+ optionals (pkgs.hostPlatform ? gcc.arch) (
+ # a builder can run code for `gcc.arch` and inferior architectures
+ [ "gccarch-${pkgs.hostPlatform.gcc.arch}" ] ++
+ map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.gcc.arch}
)
);
diff --git a/nixos/modules/services/networking/nomad.nix b/nixos/modules/services/networking/nomad.nix
index e6bbb607aaaf..dafdae0c327b 100644
--- a/nixos/modules/services/networking/nomad.nix
+++ b/nixos/modules/services/networking/nomad.nix
@@ -49,12 +49,20 @@ in
'';
};
+ extraSettingsPaths = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ Additional settings paths used to configure nomad. These can be files or directories.
+ '';
+ example = literalExample ''
+ [ "/etc/nomad-mutable.json" "/run/keys/nomad-with-secrets.json" "/etc/nomad/config.d" ]
+ '';
+ };
+
settings = mkOption {
type = format.type;
- default = {
- # Agrees with `StateDirectory = "nomad"` set below.
- data_dir = "/var/lib/nomad";
- };
+ default = {};
description = ''
Configuration for Nomad. See the <link xlink:href="https://www.nomadproject.io/docs/configuration">documentation</link>
for supported values.
@@ -77,6 +85,11 @@ in
##### implementation
config = mkIf cfg.enable {
+ services.nomad.settings = {
+ # Agrees with `StateDirectory = "nomad"` set below.
+ data_dir = mkDefault "/var/lib/nomad";
+ };
+
environment = {
etc."nomad.json".source = format.generate "nomad.json" cfg.settings;
systemPackages = [ cfg.package ];
@@ -99,7 +112,8 @@ in
serviceConfig = {
DynamicUser = cfg.dropPrivileges;
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
- ExecStart = "${cfg.package}/bin/nomad agent -config=/etc/nomad.json";
+ ExecStart = "${cfg.package}/bin/nomad agent -config=/etc/nomad.json" +
+ concatMapStrings (path: " -config=${path}") cfg.extraSettingsPaths;
KillMode = "process";
KillSignal = "SIGINT";
LimitNOFILE = 65536;
@@ -114,6 +128,7 @@ in
} // (optionalAttrs cfg.enableDocker {
SupplementaryGroups = "docker"; # space-separated string
});
+
unitConfig = {
StartLimitIntervalSec = 10;
StartLimitBurst = 3;