about summary refs log tree commit diff
path: root/fun/idual/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-04-25T23·24+0100
committerVincent Ambo <tazjin@google.com>2020-04-25T23·28+0100
commit6644d0031da7af16effda4287ea2da17506ee415 (patch)
tree0cd32cf4f408c981143c1ffedfbd44f88d41f895 /fun/idual/default.nix
parent28bf77a1f12b720d4e1448434f3eda94814bcad4 (diff)
feat(fun/idual && nixos/camden): Add light alarm systemd units r/688
Adds a systemd unit to run the idual light alarm using a transient
timer created by systemd-run.
Diffstat (limited to 'fun/idual/default.nix')
-rw-r--r--fun/idual/default.nix11
1 files changed, 8 insertions, 3 deletions
diff --git a/fun/idual/default.nix b/fun/idual/default.nix
index e051f1c812e4..1ac87ab47f0f 100644
--- a/fun/idual/default.nix
+++ b/fun/idual/default.nix
@@ -12,8 +12,13 @@ let
       python.broadlink
     ];
   };
-in lib.fix (self: {
   package = python3Packages.buildPythonPackage opts;
   script  = python3Packages.buildPythonApplication opts;
-  python  = python3.withPackages (_: [ self.package ]);
-})
+in {
+  inherit script;
+  python  = python3.withPackages (_: [ package ]);
+  setAlarm = pkgs.writeShellScriptBin "set-alarm" ''
+    echo "setting an alarm for ''${1}"
+    ${pkgs.systemd}/bin/systemd-run --user --on-calendar="''${1} Europe/London" --unit=light-alarm.service
+  '';
+}