tvl-depot/fun/idual/default.nix
Vincent Ambo 6644d0031d feat(fun/idual && nixos/camden): Add light alarm systemd units
Adds a systemd unit to run the idual light alarm using a transient
timer created by systemd-run.
2020-04-26 00:28:19 +01:00

24 lines
609 B
Nix

{ 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
'';
}