about summary refs log tree commit diff
path: root/fun/idual/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'fun/idual/default.nix')
-rw-r--r--fun/idual/default.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/fun/idual/default.nix b/fun/idual/default.nix
new file mode 100644
index 000000000000..1ac87ab47f0f
--- /dev/null
+++ b/fun/idual/default.nix
@@ -0,0 +1,24 @@
+{ pkgs, lib, ... }:
+
+let
+  inherit (pkgs) python python3 python3Packages;
+
+  opts = {
+    pname   = "idualctl";
+    version = "0.1";
+    src     = ./.;
+
+    propagatedBuildInputs = [
+      python.broadlink
+    ];
+  };
+  package = python3Packages.buildPythonPackage opts;
+  script  = python3Packages.buildPythonApplication opts;
+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
+  '';
+}