static-nix-shell: avoid wrapping when not necessary

i guess this would be a minor perf gain in places
This commit is contained in:
Colin 2023-09-24 17:51:19 +00:00
parent c7c90a9fa3
commit 699c4301b4

View File

@ -50,6 +50,7 @@ in rec {
# allow any package to be a list of packages, to support things like
# -p python3Packages.foo.propagatedBuildInputs
pkgsEnv' = lib.flatten pkgsEnv;
doWrap = pkgsEnv' != [];
in
stdenv.mkDerivation ({
version = "0.1.0"; # default version
@ -69,9 +70,11 @@ in rec {
# ensure that all nix-shell references were substituted
(! grep nix-shell $out/bin/${srcPath}) || exit 1
'' + lib.optionalString doWrap ''
# add runtime dependencies to PATH
wrapProgram $out/bin/${srcPath} \
--suffix PATH : ${lib.makeBinPath pkgsEnv' }
'' + ''
runHook postInstall
'';