summary refs log tree commit diff
path: root/pkgs/tools/compression/mozlz4a/default.nix
blob: 834b7698cf85fd845a5d1abb4cc9c85a720cf8a5 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ lib
, stdenv
, fetchurl
, python3
, runtimeShell
}:

stdenv.mkDerivation rec {
  pname = "mozlz4a";
  version = "2022-03-19";

  src = fetchurl {
    url = "https://gist.githubusercontent.com/Tblue/62ff47bef7f894e92ed5/raw/c12fce199a97ecb214eb913cc5d762eac2e92c57/mozlz4a.py";
    hash = "sha256-Igj9u6TmV+nIuSg8gI8zD4hTb/Iiog/3aB3DDk0Lqkg=";
  };

  dontUnpack = true;

  buildInputs = [ python3 python3.pkgs.lz4 ];

  installPhase = ''
    mkdir -p "$out/bin" "$out/${python3.sitePackages}/"
    cp "${src}" "$out/${python3.sitePackages}/mozlz4a.py"

    echo "#!${runtimeShell}" >> "$out/bin/mozlz4a"
    echo "export PYTHONPATH='$PYTHONPATH'" >> "$out/bin/mozlz4a"
    echo "'${python3}/bin/python' '$out/${python3.sitePackages}/mozlz4a.py' \"\$@\"" >> "$out/bin/mozlz4a"
    chmod a+x "$out/bin/mozlz4a"
  '';

  meta = with lib; {
    description = "MozLz4a compression/decompression utility";
    license = licenses.bsd2;
    maintainers = with maintainers; [ kira-bruneau pshirshov raskin ];
    platforms = python3.meta.platforms;
    homepage = "https://gist.github.com/Tblue/62ff47bef7f894e92ed5";
  };
}