1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 10:11:47 +02:00

Merge pull request #11902 from roberth/fix-issue-11892

Fix issue #11892
This commit is contained in:
Robert Hensing 2024-11-18 22:20:01 +01:00 committed by GitHub
commit 6b0aceedc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 5 deletions

View file

@ -340,13 +340,15 @@ static void main_nix_build(int argc, char * * argv)
exprs = {state->parseStdin()};
else
for (auto i : remainingArgs) {
auto baseDir = inShebang && !packages ? absPath(dirOf(script)) : i;
if (fromArgs)
if (fromArgs) {
auto shebangBaseDir = absPath(dirOf(script));
exprs.push_back(state->parseExprFromString(
std::move(i),
(inShebang && compatibilitySettings.nixShellShebangArgumentsRelativeToScript) ? lookupFileArg(*state, baseDir) : state->rootPath(".")
(inShebang && compatibilitySettings.nixShellShebangArgumentsRelativeToScript)
? lookupFileArg(*state, shebangBaseDir)
: state->rootPath(".")
));
}
else {
auto absolute = i;
try {