diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-03-02 01:03:13 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-03-28 11:54:19 +0100 |
commit | 7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61 (patch) | |
tree | 2e2aa021f425d39a7911107b6b3fd0d110d26a91 /modules/system/boot/systemd.nix | |
parent | 9c3a31ff4c5024fcb449c71f423768b6acf2f431 (diff) | |
download | nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.tar nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.tar.gz nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.tar.bz2 nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.tar.lz nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.tar.xz nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.tar.zst nixpkgs-7ad91f31d6cd6360e1f01e8e5ee3d04872f19e61.zip |
Add support for systemd timers
Diffstat (limited to 'modules/system/boot/systemd.nix')
-rw-r--r-- | modules/system/boot/systemd.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index dabb6f6661b..f99eca91ad5 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -278,6 +278,18 @@ let ''; }; + timerToUnit = name: def: + { inherit (def) wantedBy enable; + text = + '' + [Unit] + ${attrsToSection def.unitConfig} + + [Timer] + ${attrsToSection def.timerConfig} + ''; + }; + mountToUnit = name: def: { inherit (def) wantedBy enable; text = @@ -410,6 +422,13 @@ in description = "Definition of systemd socket units."; }; + systemd.timers = mkOption { + default = {}; + type = types.attrsOf types.optionSet; + options = [ timerOptions unitConfig ]; + description = "Definition of systemd timer units."; + }; + systemd.mounts = mkOption { default = []; type = types.listOf types.optionSet; @@ -552,6 +571,7 @@ in mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets // mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.services // mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.sockets + // mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.timers // listToAttrs (map (v: let n = escapeSystemdPath v.where; in nameValuePair "${n}.mount" (mountToUnit n v)) cfg.mounts); |