Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make #!nix-shell arguments and options relative to script #11058

Merged
merged 29 commits into from
Jul 17, 2024

Conversation

roberth
Copy link
Member

@roberth roberth commented Jul 6, 2024

Motivation

Fix and finish #5088.
Add an opt out similar to #11057.

Context

This is a merge of

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

matthewbauer and others added 18 commits November 27, 2023 14:40
When writing a shebang script, you expect your path to be relative to
the script, not the cwd. We previously handled this correctly for
relative file paths, but not for expressions.

This handles both -p & -E args. My understanding is this should be
what we want in any cases I can think of - people run scripts from
many different working directories. @edolstra is there any reason to
handle -p args differently in this case?

Fixes NixOS#4232
@github-actions github-actions bot added documentation with-tests Issues related to testing. PRs with tests have some priority labels Jul 6, 2024
@roberth roberth added bug breaking Changes we can't make without breaking old expressions, changing hashes, etc labels Jul 6, 2024
@roberth roberth added the cli The old and/or new command line interface label Jul 7, 2024
@roberth roberth marked this pull request as ready for review July 10, 2024 14:26
@roberth roberth changed the title More nix shell Make nix shell shebang arguments and options relative to script Jul 10, 2024
@roberth roberth changed the title Make nix shell shebang arguments and options relative to script Make #!nix-shell arguments and options relative to script Jul 10, 2024
src/libcmd/compatibility-settings.hh Outdated Show resolved Hide resolved
// Added in Nix 2.24, July 2024.
Setting<bool> nixShellShebangArgumentsRelativeToScript{
this, true, "nix-shell-shebang-arguments-relative-to-script", R"(
Before Nix 2.24, the arguments in a `nix-shell` shebang - as well as `--arg` - were relative to working directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Before Nix 2.24, the arguments in a `nix-shell` shebang - as well as `--arg` - were relative to working directory.
Before Nix 2.24, arguments in a `nix-shell` shebang - as well as `--arg` - referring to file system locations were relative to working directory.

doc/manual/rl-next/shebang-relative.md Outdated Show resolved Hide resolved
src/libcmd/compatibility-settings.hh Outdated Show resolved Hide resolved
@edolstra edolstra merged commit 1e1a8e8 into NixOS:master Jul 17, 2024
11 checks passed
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-07-17-nix-team-meeting-minutes-162/49255/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Changes we can't make without breaking old expressions, changing hashes, etc bug cli The old and/or new command line interface documentation with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants