Added the possibility to add extra runtime inputs to scripts
This commit is contained in:
1 parent
bff94c383a
commit
5516d6548c
1 file changed
+4
-4
@@ -12,27 +12,27 @@
|
|||||||
pkgs = import nixpkgs { inherit system;};
|
pkgs = import nixpkgs { inherit system;};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
writePythonApplication = {name, contentFile}: let
|
writePythonApplication = {name, contentFile, extraRuntimeInputs ? []}: let
|
||||||
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];
|
pkgs.python311] ++ extraRuntimeInputs;
|
||||||
text = ''
|
text = ''
|
||||||
exec ${pkgs.python38}/bin/python ${wrappedScript} "$@"
|
exec ${pkgs.python38}/bin/python ${wrappedScript} "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
writeBabashkaApplication = {name, contentFile}: let
|
writeBabashkaApplication = {name, contentFile, extraRuntimeInputs ? []}: let
|
||||||
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.babashka];
|
pkgs.babashka] ++ extraRuntimeInputs;
|
||||||
text = ''
|
text = ''
|
||||||
exec ${pkgs.babashka}/bin/bb ${wrappedScript} "$@"
|
exec ${pkgs.babashka}/bin/bb ${wrappedScript} "$@"
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in new issue
Block a user