From 6b7c3879c75f41469edc6897a9dfabf5f0ae17d9 Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sun, 25 Sep 2022 14:11:36 +0200 Subject: home: systemd: refactor services with a timer --- home/pkgs/lib/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 home/pkgs/lib/default.nix (limited to 'home/pkgs/lib') 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"; }; + }; + }; +} -- cgit v1.2.3