Added possibility to use specific python in writePythonApplication.
This feature can be useful to add script dependant dependencies using pkgs.python3.withPackages.
This commit is contained in:
1 parent
5516d6548c
commit
6240fd4b14
1 file changed
+12
-10
@@ -12,18 +12,20 @@
|
|||||||
pkgs = import nixpkgs { inherit system;};
|
pkgs = import nixpkgs { inherit system;};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
writePythonApplication = {name, contentFile, extraRuntimeInputs ? []}: let
|
writePythonApplication = {name, contentFile, extraRuntimeInputs ? [], python ? null}:
|
||||||
|
let
|
||||||
|
python-to-use = python == null then pkgs.python311 else python;
|
||||||
wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile);
|
wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile);
|
||||||
in
|
in
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
name = name;
|
name = name;
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
wrappedScript
|
wrappedScript
|
||||||
pkgs.python311] ++ extraRuntimeInputs;
|
if python-to-use] ++ extraRuntimeInputs;
|
||||||
text = ''
|
text = ''
|
||||||
exec ${pkgs.python38}/bin/python ${wrappedScript} "$@"
|
exec ${python-to-use}/bin/python ${wrappedScript} "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
writeBabashkaApplication = {name, contentFile, extraRuntimeInputs ? []}: let
|
writeBabashkaApplication = {name, contentFile, extraRuntimeInputs ? []}: let
|
||||||
wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile);
|
wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile);
|
||||||
|
|||||||
Reference in new issue
Block a user