diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index aa1941fa3d19..ff47eeb72b2c 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -225,15 +225,21 @@ stdenv.mkDerivation rec { # Install the helper scripts to bin/ to resemble the upstream package mkdir -p $out/bin - install -m755 src/Misc/layoutbin/runsvc.sh $out/bin/ - install -m755 src/Misc/layoutbin/RunnerService.js $out/lib/ - install -m755 src/Misc/layoutroot/run.sh $out/lib/ - install -m755 src/Misc/layoutroot/config.sh $out/lib/ - install -m755 src/Misc/layoutroot/env.sh $out/lib/ + install -m755 src/Misc/layoutbin/runsvc.sh $out/bin/ + install -m755 src/Misc/layoutbin/RunnerService.js $out/lib/ + install -m755 src/Misc/layoutroot/run.sh $out/lib/ + install -m755 src/Misc/layoutroot/run-helper.sh.template $out/lib/run-helper.sh + install -m755 src/Misc/layoutroot/config.sh $out/lib/ + install -m755 src/Misc/layoutroot/env.sh $out/lib/ # Rewrite reference in helper scripts from bin/ to lib/ - substituteInPlace $out/lib/run.sh --replace '"$DIR"/bin' "$out/lib" - substituteInPlace $out/lib/config.sh --replace './bin' "$out/lib" + substituteInPlace $out/lib/run.sh --replace '"$DIR"/bin' '"$DIR"/lib' + substituteInPlace $out/lib/config.sh --replace './bin' $out'/lib' \ + --replace 'source ./env.sh' $out/bin/env.sh + + # Remove uneeded copy for run-helper template + substituteInPlace $out/lib/run.sh --replace 'cp -f "$DIR"/run-helper.sh.template "$DIR"/run-helper.sh' ' ' + substituteInPlace $out/lib/run-helper.sh --replace '"$DIR"/bin/' '"$DIR"/' # Make paths absolute substituteInPlace $out/bin/runsvc.sh \ @@ -269,7 +275,7 @@ stdenv.mkDerivation rec { wrap() { makeWrapper $out/lib/$1 $out/bin/$1 \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (buildInputs ++ [ openssl ])} \ - ''${@:2} + "''${@:2}" } fix_rpath Runner.Listener @@ -279,10 +285,13 @@ stdenv.mkDerivation rec { wrap Runner.Listener wrap Runner.PluginHost wrap Runner.Worker - wrap run.sh - wrap env.sh + wrap run.sh --run 'export RUNNER_ROOT=''${RUNNER_ROOT:-$HOME/.github-runner}' + wrap env.sh --run 'cd $RUNNER_ROOT' - wrap config.sh --prefix PATH : ${lib.makeBinPath [ glibc.bin ]} + wrap config.sh --run 'export RUNNER_ROOT=''${RUNNER_ROOT:-$HOME/.github-runner}' \ + --run 'mkdir -p $RUNNER_ROOT' \ + --prefix PATH : ${lib.makeBinPath [ glibc.bin ]} \ + --chdir $out ''; # Script to create deps.nix file for dotnet dependencies. Run it with