-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
mkShell: make it buildable #153194
mkShell: make it buildable #153194
Conversation
You could also write out a shell script that behaves like a better Right now, the output is a single file with no room for extension, because it is not a directory. A good first step is to write to |
There is an infinite number of things I could do. The question is; is this PR better than before? I will make it so that the file is unusable, as it's not meant to be part of the interface. |
When I designed `mkShell`, I didn't have a good idea of what the output should look like and so decided to make the build fail. In practice, this causes quite a bit of confusion and complications because now the shell cannot be part of a normal package set without failing the CI as well. This commit changes that build phase to record all the build inputs in a file. That way it becomes possible to build it, makes sure that all the build inputs get built as well, and also can be used as a GC root. (by applying the same trick as NixOS#95536). The documentation has also been improved to better describe what mkShell does and how to use it.
9fe7be3
to
28e0397
Compare
I'm not asking you to do an infinite number of things, just to prevent a future breaking change.
That makes it a non-breaking change. 👍 |
|
||
buildPhase = '' | ||
echo "-------------------------------------------" >> $out | ||
echo " Do not use this file. See the mkShell doc." >>$out |
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.
I don't quite understand why. Could you explain it here in the message?
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.
Ok, this is ready for another round of review.
Co-authored-by: Robert Hensing <[email protected]>
Co-authored-by: Robert Hensing <[email protected]>
Co-authored-by: Robert Hensing <[email protected]>
Co-authored-by: Cole Helbling <[email protected]>
Waiting for a last round of reviews. |
|
@Atry well spotted. Feel free to go ahead. |
There's still equivalent logic to the restriction this pulls elsewhere in nixpkgs: pkgs/build-support/build-fhsenv-bubblewrap/default.nix: echo >&2 "*** User chroot 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
pkgs/build-support/build-fhsenv-chroot/default.nix: echo >&2 "*** User chroot 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
pkgs/development/interpreters/lua-5/wrapper.nix: echo >&2 "*** lua 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
pkgs/development/interpreters/octave/build-env.nix: echo >&2 "*** octave 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
pkgs/development/interpreters/python/wrapper.nix: echo >&2 "*** Python 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
pkgs/development/ruby-modules/bundled-common/default.nix: echo >&2 "*** Ruby 'env' attributes are intended for interactive nix-shell sessions, not for building! ***" |
When I designed
mkShell
, I didn't have a good idea of what the outputshould look like and so decided to make the build fail. In practice,
this causes quite a bit of confusion and complications because now the
shell cannot be part of a normal package set without failing the CI as
well.
This commit changes that build phase to record all the build inputs in a
file. That way it becomes possible to build it, makes sure that all the
build inputs get built as well, and also can be used as a GC root.
(by applying the same trick as #95536).
The documentation has also been improved to better describe what mkShell
does and how to use it.
Motivation for this change
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes