1
0
Files
nixfiles/pkgs/build-support/writePythonScript.nix

38 lines
509 B
Nix

{
python3,
writeTextFile,
lib,
}:
{
name,
text,
runtimePackages ? ps: [],
pythonPackage ? python3,
meta ? {},
passthru ? {},
derivationArgs ? {},
}:
let
pythonWithPackages = pythonPackage.withPackages runtimePackages;
in writeTextFile {
inherit
name
meta
passthru
derivationArgs
;
executable = true;
destination = "/bin/${name}";
allowSubstitutes = true;
preferLocalBuild = false;
text = ''
#!${lib.getExe pythonWithPackages}
${text}
'';
}