summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ti/timetagger/package.nix
blob: 93a6a542a67df14a780ba0fdaa5ad9d5c5bde43a (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
26
27
28
29
30
31
32
33
34
35
36
{
  python3,

  addr ? "127.0.0.1",
  port ? 8082,
}:

#
# Timetagger itself is a library that a user must write a "run.py" script for
# We provide a basic "run.py" script with this package, which simply starts
# timetagger.
#

python3.pkgs.buildPythonApplication {
  inherit (python3.pkgs.timetagger)
    pname
    version
    src
    meta
    ;

  propagatedBuildInputs = with python3.pkgs; [
    setuptools
    timetagger
  ];

  format = "custom";
  installPhase = ''
    mkdir -p $out/bin
    echo "#!${python3.interpreter}" >> $out/bin/timetagger
    cat timetagger/__main__.py >> $out/bin/timetagger
    chmod +x $out/bin/timetagger
    wrapProgram $out/bin/timetagger \
      --set TIMETAGGER_BIND "${addr}:${toString port}"
  '';
}