diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-18 13:18:58 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-18 18:04:16 +0100 |
commit | 08a85c2152192f231dccea4d7a3c26dd894d9812 (patch) | |
tree | e4793f8a5acb066a1a00766ff01dd92edd275d98 /nixos/modules/system | |
parent | 174f5813ef39ead3e42e70003242baadde92156a (diff) | |
download | nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.tar nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.tar.gz nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.tar.bz2 nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.tar.lz nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.tar.xz nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.tar.zst nixpkgs-08a85c2152192f231dccea4d7a3c26dd894d9812.zip |
Allow building/testing individual systemd units
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 8895f9bf727..5c25dabd0c0 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -311,8 +311,6 @@ let ''; }; - nixosUnits = mapAttrsToList makeUnit cfg.units; - units = pkgs.runCommand "units" { preferLocalBuild = true; } '' mkdir -p $out @@ -338,7 +336,7 @@ let done done - for i in ${toString nixosUnits}; do + for i in ${toString (mapAttrsToList (n: v: v.unit) cfg.units)}; do ln -s $i/* $out/ done @@ -387,32 +385,41 @@ in description = "Definition of systemd units."; default = {}; type = types.attrsOf types.optionSet; - options = { - text = mkOption { - type = types.str; - description = "Text of this systemd unit."; - }; - enable = mkOption { - default = true; - type = types.bool; - description = '' - If set to false, this unit will be a symlink to - /dev/null. This is primarily useful to prevent specific - template instances (e.g. <literal>serial-getty@ttyS0</literal>) - from being started. - ''; - }; - requiredBy = mkOption { - default = []; - type = types.listOf types.string; - description = "Units that require (i.e. depend on and need to go down with) this unit."; + options = { name, config, ... }: + { options = { + text = mkOption { + type = types.str; + description = "Text of this systemd unit."; + }; + enable = mkOption { + default = true; + type = types.bool; + description = '' + If set to false, this unit will be a symlink to + /dev/null. This is primarily useful to prevent specific + template instances (e.g. <literal>serial-getty@ttyS0</literal>) + from being started. + ''; + }; + requiredBy = mkOption { + default = []; + type = types.listOf types.string; + description = "Units that require (i.e. depend on and need to go down with) this unit."; + }; + wantedBy = mkOption { + default = []; + type = types.listOf types.string; + description = "Units that want (i.e. depend on) this unit."; + }; + unit = mkOption { + internal = true; + description = "The generated unit."; + }; + }; + config = { + unit = makeUnit name config; + }; }; - wantedBy = mkOption { - default = []; - type = types.listOf types.string; - description = "Units that want (i.e. depend on) this unit."; - }; - }; }; systemd.packages = mkOption { |