summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd.nix
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2022-03-19 04:02:39 -0400
committerWill Fancher <elvishjerricco@gmail.com>2022-03-21 10:25:27 -0400
commit52c98fc3e9b593f1b98caeb00864f884e897866f (patch)
tree84998004d43e48bb57fc148fdc6cb98a8ac0673e /nixos/modules/system/boot/systemd.nix
parent397b8257a0f926c518a01dd20d2911945a649743 (diff)
downloadnixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.tar
nixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.tar.gz
nixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.tar.bz2
nixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.tar.lz
nixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.tar.xz
nixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.tar.zst
nixpkgs-52c98fc3e9b593f1b98caeb00864f884e897866f.zip
nixos: systemd: Split unit types into separate module
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r--nixos/modules/system/boot/systemd.nix28
1 files changed, 9 insertions, 19 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 057474c607a..396457e1a9f 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -14,10 +14,6 @@ let
     makeUnit
     generateUnits
     makeJobScript
-    unitConfig
-    serviceConfig
-    mountConfig
-    automountConfig
     commonUnitText
     targetToUnit
     serviceToUnit
@@ -185,13 +181,7 @@ in
     systemd.units = mkOption {
       description = "Definition of systemd units.";
       default = {};
-      type = with types; attrsOf (submodule (
-        { name, config, ... }:
-        { options = concreteUnitOptions;
-          config = {
-            unit = mkDefault (makeUnit name config);
-          };
-        }));
+      type = systemdUtils.types.units;
     };
 
     systemd.packages = mkOption {
@@ -203,37 +193,37 @@ in
 
     systemd.targets = mkOption {
       default = {};
-      type = with types; attrsOf (submodule [ { options = targetOptions; } unitConfig] );
+      type = systemdUtils.types.targets;
       description = "Definition of systemd target units.";
     };
 
     systemd.services = mkOption {
       default = {};
-      type = with types; attrsOf (submodule [ { options = serviceOptions; } unitConfig serviceConfig ]);
+      type = systemdUtils.types.services;
       description = "Definition of systemd service units.";
     };
 
     systemd.sockets = mkOption {
       default = {};
-      type = with types; attrsOf (submodule [ { options = socketOptions; } unitConfig ]);
+      type = systemdUtils.types.sockets;
       description = "Definition of systemd socket units.";
     };
 
     systemd.timers = mkOption {
       default = {};
-      type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ]);
+      type = systemdUtils.types.timers;
       description = "Definition of systemd timer units.";
     };
 
     systemd.paths = mkOption {
       default = {};
-      type = with types; attrsOf (submodule [ { options = pathOptions; } unitConfig ]);
+      type = systemdUtils.types.paths;
       description = "Definition of systemd path units.";
     };
 
     systemd.mounts = mkOption {
       default = [];
-      type = with types; listOf (submodule [ { options = mountOptions; } unitConfig mountConfig ]);
+      type = systemdUtils.types.mounts;
       description = ''
         Definition of systemd mount units.
         This is a list instead of an attrSet, because systemd mandates the names to be derived from
@@ -243,7 +233,7 @@ in
 
     systemd.automounts = mkOption {
       default = [];
-      type = with types; listOf (submodule [ { options = automountOptions; } unitConfig automountConfig ]);
+      type = systemdUtils.types.automounts;
       description = ''
         Definition of systemd automount units.
         This is a list instead of an attrSet, because systemd mandates the names to be derived from
@@ -253,7 +243,7 @@ in
 
     systemd.slices = mkOption {
       default = {};
-      type = with types; attrsOf (submodule [ { options = sliceOptions; } unitConfig] );
+      type = systemdUtils.types.slices;
       description = "Definition of slice configurations.";
     };