summaryrefslogtreecommitdiff
path: root/home/pkgs/lib
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2022-09-25 14:11:36 +0200
committerQuentin Aristote <quentin@aristote.fr>2022-09-25 14:11:36 +0200
commit6b7c3879c75f41469edc6897a9dfabf5f0ae17d9 (patch)
tree34c72a75bc051ab0b0a791c64282f9d4907151df /home/pkgs/lib
parent97c1db512c252e5dc82ad8092973fa591ff813f6 (diff)
home: systemd: refactor services with a timer
Diffstat (limited to 'home/pkgs/lib')
-rw-r--r--home/pkgs/lib/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/home/pkgs/lib/default.nix b/home/pkgs/lib/default.nix
new file mode 100644
index 0000000..55e6c20
--- /dev/null
+++ b/home/pkgs/lib/default.nix
@@ -0,0 +1,11 @@
+{ pkgs }:
+
+{
+ serviceWithTimer = name: { Unit, Service, Timer, Install, ... }@config: {
+ services.${name} = { inherit (config) Unit Install Service; };
+ timers.${name} = {
+ inherit (config) Unit Install;
+ Timer = config.Timer // { Unit = "${name}.service"; };
+ };
+ };
+}