dadc7eb329
Whenever we create scripts that are installed to $out, we must use runtimeShell in order to get the shell that can be executed on the machine we create the package for. This is relevant for cross-compiling. The only use case for stdenv.shell are scripts that are executed as part of the build system. Usages in checkPhase are borderline however to decrease the likelyhood of people copying the wrong examples, I decided to use runtimeShell as well.
36 lines
1.2 KiB
Nix
36 lines
1.2 KiB
Nix
{ stdenv, fetchurl, python3, runtimeShell }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "${pname}-${version}";
|
|
pname = "mozlz4a";
|
|
version = "2018-08-23";
|
|
# or fetchFromGitHub(owner,repo,rev) or fetchgit(rev)
|
|
src = fetchurl {
|
|
url = "https://gist.githubusercontent.com/kaefer3000/73febe1eec898cd50ce4de1af79a332a/raw/a266410033455d6b4af515d7a9d34f5afd35beec/mozlz4a.py";
|
|
sha256 = "1d1ai062kdms34bya9dlykkx011rj8d8nh5l7d76xj8k9kv4ssq6";
|
|
};
|
|
|
|
unpackPhase = "true;";
|
|
|
|
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"
|
|
'';
|
|
|
|
buildInputs = [ python3 python3.pkgs.python-lz4 ];
|
|
|
|
meta = {
|
|
inherit version;
|
|
description = "A script to handle Mozilla's mozlz4 files";
|
|
license = stdenv.lib.licenses.bsd2;
|
|
maintainers = [stdenv.lib.maintainers.raskin];
|
|
platforms = stdenv.lib.platforms.linux;
|
|
homepage = https://gist.githubusercontent.com/Tblue/62ff47bef7f894e92ed5;
|
|
};
|
|
}
|