-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow to get rid of nix develop
"shell" logic
#7501
Comments
Discussed in Nix team meeting 2022-12-23:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2022-12-23-nix-team-meeting-minutes-19/24400/1 |
Most of the non- |
Steps ahead
Random notes:
|
Discussed in the Nix team meeting 2023-01-23:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-01-23-nix-team-meeting-minutes-26/25433/1 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-04-14-nix-team-meeting-minutes-48/27358/1 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-07-03-nix-team-meeting-minutes-68/30337/1 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/flakey-profile-declarative-nix-profiles-as-flakes/35163/3 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/why-doesnt-nix-collect-garbage-collect-all-the-garbage/38587/16 |
Related: #4702 (comment) |
@fricklerhandwerk, in #4702 (comment) you propose to
Did you mean that list to be exhaustive - ie discourage even a simple I believe this extra entrypoint - |
Not exactly exhaustive, but a good approximation. I haven't made up my mind on |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nixpkgs-cli-working-group-member-search/30517/22 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-04-10-nix-team-meeting-138/43585/1 |
Is your feature request related to a problem? Please describe.
Remove the tight coupling with stdenv by defining a small interface
We have a number of bugs and feature requests related to
nix-shell
andnix develop
."Shells" appear to be built on derivations, but they are not a derivation feature. A derivation has a builder, which is a self-contained, non-interactive process that's written for a single purpose.
Currently, to create a shell, Nix has to intrude on
stdenv
's domain and make assumptions about how the builder is implemented in order to modify the derivation to support some specific code it needs to run.This creates a situation where
nix develop
andstdenv
are tightly coupled, which holds back both components' development and does not allow alternative derivation builders to support shells.To break this tight coupling, I propose a new interface between
nix develop
and the expression language. Instead of taking apart a derivation, we can ask the expression nicely to produce a command that launches a shell for us.Concretely, this means
nix develop
will perform the following pseudocodeEDIT: additionally, see below for
isDevShell
By delegating the construction of a shell process to stdenv, we empower Nixpkgs to solve its own problems. This has the additional benefit that Nixpkgs allows easier collaboration, breaking changes and more risk taking in general. After all
nix
has a much stronger expectation of compatibility, becausenix
can not be pinned to projects.Other benefits include
getDerivationEnvironment
as a primop to referencenix develop
drv from Nix code #7468 ("XY problem")Out of scope for this change (but relevant)
nix-shell
, but it just doesn't produce a sandbox environment, leading to questions, typically: "why does this work in nix-shell, but not in my build?". This should be solved by a different command that is capable of producing an actual sandbox environment. This is a significantly different task that needs its own solution. It does also need to interface with user code, but in this case it's the derivation, not the expression that should be asked. This slightly special sandbox may be differentiated by only the existence of a tty on stdin, or perhaps also a single special environment variable. It will be up to the builder process to read these clues and kick into a debugging mode; typically an interactive shell.Describe the solution you'd like
See pseudocode above.
Similarly:
Describe alternatives you've considered
Keep status quo, expend Nix team effort on shell features that the community can more easily fix themselves, and leave more important Nix issues and improvements behind.
Additional context
Solution to
getDerivationEnvironment
as a primop to referencenix develop
drv from Nix code #7468Possible nixpkgs-side
devShell
implementation stubPushes
nix develop
toward the dev side ofPriorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: