about summary refs log tree commit diff
path: root/pkgs/wywozik-todo/default.nix
blob: 37fccfb267ebd77ff65c4f3218c7508a17456ae4 (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
37
38
39
40
41
42
43
{ stdenv, runCommand, fetchgit, python3,
configFile ? ''
  CITY = "Poznań"
  STREET = "ul. Święty Marcin"
  NUMBER = "1"
  HOUSING = "zamieszkana"
  TOKEN = "token"
''
}:
with stdenv.lib;

let
  packages = p: with p; [
    requests
  ];
  py = python3.withPackages packages;
in
stdenv.mkDerivation {
  name = "wywozik-todo";

  src = fetchgit {
    url = "https://github.com/pniedzwiedzinski/wywozik-todo";
    rev = "d214fda2a4c9900086f2d0678a2d6f96ce7a69df";
    sha256 = "1lsmgh07dz0iqw3kd6yq7m2rpss7jx8721jmh2vyvnbybb1cna37";
  };

  buildInputs = [ py ];

  buildPhase = ''
      sed -i '1s:^:#!${py}/bin/python\n:' main.py
      chmod +x main.py
  '';

  installPhase = ''
      mkdir -p $out/bin
      cp main.py $out/bin/wywozik-todo
      echo '${configFile}' > $out/bin/config.py
  '';

  meta = {
    homepage = "https://github.com/pniedzwiedzinski/wywozik-todo";
  };
}