diff --git a/flake.nix b/flake.nix index 92c5a0a..c2d64f2 100644 --- a/flake.nix +++ b/flake.nix @@ -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);