-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
stdenv: export minimum bash version for Nix #299490
base: master
Are you sure you want to change the base?
stdenv: export minimum bash version for Nix #299490
Conversation
Relates to NixOS/nix#10263 and NixOS#296936 This will help external tools (Nix and direnv for now) perform the same version check setup.sh is already doing when building.
9d84daf
to
6cc2e99
Compare
Converted to draft until Nix Team makes a decision on NixOS/nix#10263. |
Allow derivations to export a `NIX_ENV_MIN_BASH_VERSION` that sets the minimal (major) bash version that is required to parse their setup script, and use that to gracefully fail if the current bash is too old. Fix #10263 (from the Nix side at least, needs NixOS/nixpkgs#299490 from the Nixpkgs side to be useful in practice)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Companion PR on the Nix side: NixOS/nix#10359
For the sake of bikeshedding (mostly): Could/should this be exposed from the Nix language instead (meta.minBashVersion
or something)? It would have the advantage of not polluting the scope even more than what we do.
Hmm, the main issue I see with this is how to keep that variable in sync with the check that We currently don't substitute any part of setup.sh (by default) AFAICT, the way to bring data in to that script is via environment variables, at which point the namespace pollution isn't solved at all. Doing string substitution on setup.sh is potentially possible, but that seems to make the whole thing a lot more complicated than it needs to be. |
Erk, right :/ |
Relates to NixOS/nix#10263 and #296936
This will help external tools (Nix and direnv for now) perform the same version check setup.sh is already doing when building.
Description of changes
setup.sh
now exports a new variableNIX_ENV_MIN_BASH_VERSION
with the value 4. This is the single source of truth now.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.