pkgs/build-support: writePythonScript add runtimeInput option
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
python3,
|
python3,
|
||||||
writeTextFile,
|
makeWrapper,
|
||||||
|
runCommand,
|
||||||
lib,
|
lib,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@
|
|||||||
text,
|
text,
|
||||||
runtimePackages ? ps: [],
|
runtimePackages ? ps: [],
|
||||||
pythonPackage ? python3,
|
pythonPackage ? python3,
|
||||||
|
runtimeInputs ? [],
|
||||||
meta ? {},
|
meta ? {},
|
||||||
passthru ? {},
|
passthru ? {},
|
||||||
derivationArgs ? {},
|
derivationArgs ? {},
|
||||||
@@ -18,13 +20,17 @@ let
|
|||||||
|
|
||||||
pythonWithPackages = pythonPackage.withPackages runtimePackages;
|
pythonWithPackages = pythonPackage.withPackages runtimePackages;
|
||||||
|
|
||||||
in writeTextFile {
|
in runCommand name ({
|
||||||
inherit
|
passAsFile = [ "text" ] ++ (derivationArgs.passAsFile or []);
|
||||||
name
|
|
||||||
meta
|
meta = {
|
||||||
passthru
|
mainProgram = name;
|
||||||
derivationArgs
|
} // meta // (derivationArgs.meta or {});
|
||||||
;
|
|
||||||
|
passthru = passthru // (derivationArgs.passthru or {});
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper ] ++ (derivationArgs.nativeBuildInputs or []);
|
||||||
|
|
||||||
executable = true;
|
executable = true;
|
||||||
destination = "/bin/${name}";
|
destination = "/bin/${name}";
|
||||||
allowSubstitutes = true;
|
allowSubstitutes = true;
|
||||||
@@ -34,4 +40,17 @@ in writeTextFile {
|
|||||||
|
|
||||||
${text}
|
${text}
|
||||||
'';
|
'';
|
||||||
}
|
} // (
|
||||||
|
builtins.removeAttrs derivationArgs [ "passAsFile" "meta" "passthru" "nativeBuildInputs" ]
|
||||||
|
))
|
||||||
|
''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
|
||||||
|
target=$out/bin/${lib.escapeShellArg name}
|
||||||
|
|
||||||
|
cp "$textPath" "$target"
|
||||||
|
|
||||||
|
chmod +x "$target"
|
||||||
|
|
||||||
|
wrapProgram "$target" --prefix PATH : "${lib.makeBinPath runtimeInputs}"
|
||||||
|
''
|
||||||
|
Reference in New Issue
Block a user