summaryrefslogtreecommitdiff
path: root/overlays/worktime/default.nix
blob: 20c0b90fe57c5f2b647495a0d5ba879517ea13cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ prev, ... }: {
  worktime = prev.stdenv.mkDerivation rec {
    name = "worktime";
    src = ./worktime.py;

    phases = [ "buildPhase" "checkPhase" "installPhase" ];

    python = prev.python39.withPackages (ps: with ps; [pyxdg python-dateutil uritools requests configparser tabulate]);
    buildInputs = [ python ];

    buildPhase = ''
      substituteAll $src worktime
    '';

    doCheck = true;
    checkPhase = ''
      python -m py_compile worktime
    '';

    installPhase = ''
      install -m 0755 -D -t $out/bin \
        worktime
    '';
  };
}