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:
didier amyot committed 2023-05-17 07:42:40 -04:00
1 parent 5516d6548c
commit 6240fd4b14
1 file changed
+12 -10
+12 -10
View File
@@ -12,18 +12,20 @@
pkgs = import nixpkgs { inherit system;};
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);
in
in
pkgs.writeShellApplication {
name = name;
runtimeInputs = [
wrappedScript
pkgs.python311] ++ extraRuntimeInputs;
text = ''
exec ${pkgs.python38}/bin/python ${wrappedScript} "$@"
'';
};
name = name;
runtimeInputs = [
wrappedScript
if python-to-use] ++ extraRuntimeInputs;
text = ''
exec ${python-to-use}/bin/python ${wrappedScript} "$@"
'';
};
writeBabashkaApplication = {name, contentFile, extraRuntimeInputs ? []}: let
wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile);