about summary refs log tree commit diff
path: root/fun/idual/default.nix
blob: 1ac87ab47f0feae98f0d63f648732da49f42e32d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
  '';
}