summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorts468 <ts468@users.noreply.github.com>2015-09-30 15:12:43 +0200
committerts468 <ts468@users.noreply.github.com>2015-09-30 15:12:43 +0200
commit1ddc1cdcf2e52346afb287434227dde0b18dce24 (patch)
tree945119ff538bfb73218776f44f8e3422abb77d96 /nixos
parentdf9fc0f8e024d755843d4055c5f702a317b468bd (diff)
parent05c46bfc05cc75ed7d52e75f59ae490fe8c4833b (diff)
downloadnixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.tar
nixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.tar.gz
nixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.tar.bz2
nixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.tar.lz
nixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.tar.xz
nixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.tar.zst
nixpkgs-1ddc1cdcf2e52346afb287434227dde0b18dce24.zip
Merge pull request #10076 from ts468/upstream.systemd
systemd module: add option to specify generators
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/systemd.nix52
1 files changed, 29 insertions, 23 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 4976dfe8eea..13c44e0930a 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -445,6 +445,17 @@ in
       '';
     };
 
+    systemd.generators = mkOption {
+      type = types.attrsOf types.path;
+      default = {};
+      example = { "systemd-gpt-auto-generator" = "/dev/null"; };
+      description = ''
+        Definition of systemd generators.
+        For each <literal>NAME = VALUE</literal> pair of the attrSet, a link is generated from
+        <literal>/etc/systemd/system-generators/NAME</literal> to <literal>VALUE</literal>.
+      '';
+    };
+
     systemd.defaultUnit = mkOption {
       default = "multi-user.target";
       type = types.str;
@@ -601,20 +612,17 @@ in
 
     environment.systemPackages = [ systemd ];
 
-    environment.etc."systemd/system".source =
-      generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants;
+    environment.etc = {
+      "systemd/system".source = generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants;
 
-    environment.etc."systemd/user".source =
-      generateUnits "user" cfg.user.units upstreamUserUnits [];
+      "systemd/user".source = generateUnits "user" cfg.user.units upstreamUserUnits [];
 
-    environment.etc."systemd/system.conf".text =
-      ''
+      "systemd/system.conf".text = ''
         [Manager]
         ${config.systemd.extraConfig}
       '';
 
-    environment.etc."systemd/journald.conf".text =
-      ''
+      "systemd/journald.conf".text = ''
         [Journal]
         RateLimitInterval=${config.services.journald.rateLimitInterval}
         RateLimitBurst=${toString config.services.journald.rateLimitBurst}
@@ -625,17 +633,26 @@ in
         ${config.services.journald.extraConfig}
       '';
 
-    environment.etc."systemd/logind.conf".text =
-      ''
+      "systemd/logind.conf".text = ''
         [Login]
         ${config.services.logind.extraConfig}
       '';
 
-    environment.etc."systemd/sleep.conf".text =
-      ''
+      "systemd/sleep.conf".text = ''
         [Sleep]
       '';
 
+      "tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf";
+      "tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
+
+      "tmpfiles.d/nixos.conf".text = ''
+        # This file is created automatically and should not be modified.
+        # Please change the option ‘systemd.tmpfiles.rules’ instead.
+
+        ${concatStringsSep "\n" cfg.tmpfiles.rules}
+      '';
+    } // mapAttrs' (n: v: nameValuePair "systemd/system-generators/${n}" {"source"=v;}) cfg.generators;
+
     system.activationScripts.systemd = stringAfter [ "groups" ]
       ''
         mkdir -m 0755 -p /var/lib/udev
@@ -736,17 +753,6 @@ in
         startSession = true;
       };
 
-    environment.etc."tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf";
-    environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
-
-    environment.etc."tmpfiles.d/nixos.conf".text =
-      ''
-        # This file is created automatically and should not be modified.
-        # Please change the option ‘systemd.tmpfiles.rules’ instead.
-
-        ${concatStringsSep "\n" cfg.tmpfiles.rules}
-      '';
-
     # Some overrides to upstream units.
     systemd.services."systemd-backlight@".restartIfChanged = false;
     systemd.services."systemd-rfkill@".restartIfChanged = false;