static-nix-shell: dont fail build if "nix-shell" occurs in the file as a non-directive

This commit is contained in:
Colin 2024-03-24 12:27:08 +00:00
parent 4e74ba5bab
commit aed5ea4b2e
1 changed files with 3 additions and 3 deletions

View File

@ -73,8 +73,8 @@ in rec {
patchPhase = ''
substituteInPlace ${srcPath} \
--replace '#!/usr/bin/env nix-shell' '#!${interpreter}' \
--replace \
--replace-fail '#!/usr/bin/env nix-shell' '#!${interpreter}' \
--replace-fail \
'#!nix-shell -i ${interpreterName}${pkgsStr}' \
'# nix deps evaluated statically'
'';
@ -85,7 +85,7 @@ in rec {
mv ${srcPath} $out/bin/${srcPath}
# ensure that all nix-shell references were substituted
(! grep nix-shell $out/bin/${srcPath}) || exit 1
(! grep '#![ \t]*nix-shell' $out/bin/${srcPath}) || exit 1
'' + lib.optionalString doWrap ''
# add runtime dependencies to PATH