Loading pkgs/build-support/trivial-builders/default.nix +8 −2 Original line number Diff line number Diff line Loading @@ -356,10 +356,16 @@ rec { export ${name} '') runtimeEnv ) + lib.optionalString (runtimeInputs != [ ]) '' + '' export PATH="${lib.makeBinPath runtimeInputs}${lib.optionalString inheritPath ":$PATH"}" export PATH="${ lib.concatStringsSep ":" ( (lib.optionals (runtimeInputs != [ ]) [ (lib.makeBinPath runtimeInputs) ]) ++ (lib.optionals inheritPath [ "$PATH" ]) ) }" '' + '' ${text} Loading pkgs/build-support/trivial-builders/test/writeShellApplication.nix +44 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,50 @@ linkFarm "writeShellApplication-tests" { ''; }; test-no-inherit-path-no-runtimeInputs = checkShellApplication { name = "test-no-inherit-path-no-runtimeInputs"; inheritPath = false; runtimeInputs = [ ]; text = '' if [[ ''${#PATH} -eq 0 ]]; then echo -n "PATH is empty" fi ''; expected = "PATH is empty"; }; test-no-inherit-path-runtimeInputs = checkShellApplication { name = "test-no-inherit-path-runtimeInputs"; inheritPath = false; runtimeInputs = [ hello ]; text = '' extra_colon_pattern='(^:|:$)' if [[ ''${PATH} =~ $extra_colon_pattern ]]; then echo "PATH should not start or end with a colon: $PATH" fi if [[ ''${#PATH} -gt 0 ]]; then echo -n "PATH is not empty" fi ''; expected = "PATH is not empty"; }; test-inherit-path-no-runtimeInputs = checkShellApplication { name = "test-inherit-path-no-runtimeInputs"; inheritPath = true; runtimeInputs = [ ]; text = '' extra_colon_pattern='(^:|:$)' if [[ ''${PATH} =~ $extra_colon_pattern ]]; then echo "PATH should not start or end with a colon: $PATH" fi if [[ ''${#PATH} -gt 0 ]]; then echo -n "PATH is not empty" fi ''; expected = "PATH is not empty"; }; test-check-phase = checkShellApplication { name = "test-check-phase"; text = ""; Loading Loading
pkgs/build-support/trivial-builders/default.nix +8 −2 Original line number Diff line number Diff line Loading @@ -356,10 +356,16 @@ rec { export ${name} '') runtimeEnv ) + lib.optionalString (runtimeInputs != [ ]) '' + '' export PATH="${lib.makeBinPath runtimeInputs}${lib.optionalString inheritPath ":$PATH"}" export PATH="${ lib.concatStringsSep ":" ( (lib.optionals (runtimeInputs != [ ]) [ (lib.makeBinPath runtimeInputs) ]) ++ (lib.optionals inheritPath [ "$PATH" ]) ) }" '' + '' ${text} Loading
pkgs/build-support/trivial-builders/test/writeShellApplication.nix +44 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,50 @@ linkFarm "writeShellApplication-tests" { ''; }; test-no-inherit-path-no-runtimeInputs = checkShellApplication { name = "test-no-inherit-path-no-runtimeInputs"; inheritPath = false; runtimeInputs = [ ]; text = '' if [[ ''${#PATH} -eq 0 ]]; then echo -n "PATH is empty" fi ''; expected = "PATH is empty"; }; test-no-inherit-path-runtimeInputs = checkShellApplication { name = "test-no-inherit-path-runtimeInputs"; inheritPath = false; runtimeInputs = [ hello ]; text = '' extra_colon_pattern='(^:|:$)' if [[ ''${PATH} =~ $extra_colon_pattern ]]; then echo "PATH should not start or end with a colon: $PATH" fi if [[ ''${#PATH} -gt 0 ]]; then echo -n "PATH is not empty" fi ''; expected = "PATH is not empty"; }; test-inherit-path-no-runtimeInputs = checkShellApplication { name = "test-inherit-path-no-runtimeInputs"; inheritPath = true; runtimeInputs = [ ]; text = '' extra_colon_pattern='(^:|:$)' if [[ ''${PATH} =~ $extra_colon_pattern ]]; then echo "PATH should not start or end with a colon: $PATH" fi if [[ ''${#PATH} -gt 0 ]]; then echo -n "PATH is not empty" fi ''; expected = "PATH is not empty"; }; test-check-phase = checkShellApplication { name = "test-check-phase"; text = ""; Loading