-
-
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
nix-shell: Support --out-link #7248
Conversation
To facilitate --out-link with nix-shell.
To support --out-link with nix-shell.
My only concern with this change is the following scenario:
The user could omit Edit: I guess this is already the way things work. So no change introduced by this PR. |
It is an input of the shell itself.
921ce36
to
7a37384
Compare
a04871c
to
5b277ba
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/1379 |
Wouldn't a temporary root solve the problem of retaining a long running shell's dependencies? This would be a cleaner solution where you don't need to put in the file system what seem to be useless links. |
It seems that |
I think probably
Would that be a breaking change to |
👍
We're definitely past the point where any detail could become a breaking change, but I'd expect even a naive implementation to fix more problems than it creates. One potential problem we can solve is passing posix signals along to the child process. The |
I agree. Though I think it might actually be nice to provide an out path for the shell.
Suppose I were to try doing temp roots in a following commit, could you do some closer review/collaboration? I don't count myself as a systems programming expert. I'm not sure I could handle signals properly, for instance. |
I'm not much of an expert either, so I don't think I'd be super helpful, but I can do a pass of review. |
Wait a second. I think temproots shouldn't even be required. GC reads /proc/*/{environ,maps} etc to check for live roots anyways: Line 348 in ffca3e3
and: $ nix-shell -p tmux --run 'nix-store --query --roots $(type -p tmux) | grep $BASHPID'
these paths will be fetched (0.34 MiB download, 0.97 MiB unpacked):
/nix/store/zfwyd14l1z0sg54d6m7jw43469si1pdw-tmux-3.3a
copying path '/nix/store/zfwyd14l1z0sg54d6m7jw43469si1pdw-tmux-3.3a' from 'https://cache.nixos.org'...
/proc/3277340/environ -> /nix/store/zfwyd14l1z0sg54d6m7jw43469si1pdw-tmux-3.3a
$ nix-store --query --roots /nix/store/zfwyd14l1z0sg54d6m7jw43469si1pdw-tmux-3.3a
=> empty Edit: So I'm not actually really sure if creating temproots is as much a solution as it is papering over a bug somewhere. Edit 2: Knowing that temproots may not be required: should --out-link be supported? It does provide a workaround for a bug. I also have a branch with a working child process/explicit temproots but now I'm not sure that should go in... |
Do you think |
Indeed, it is. The current approach isn't exactly right though, because:
What |
|
I mentioned this above as a UX problem . I am not sure this is entirely a problem. For back-compat I could see there being problem cases. But in the back-compat case Two additional things about this:
I think this is generally a very hard problem to solve with the tools nix has and with the existence of Edit: Another thought: this |
Indeed. Looks like I'm nearly one year late to the party 😛
Do you mean that there's no guaranty that
I don't think it is. Things like
Quite the contrary, I would say. At any rate, this new flag is just combining |
It fits with my correct-by-construction philosophy, at least 😄 .
I mean things like this: nix/src/nix-build/nix-build.cc Line 266 in f225f43
which rely on As an aside, because of that line in nix-build.cc,
Regarding --out-flags semantics:
If
... I agree.
"Just" combining
(Edit: I guess if Edit 2:
Would you reconsider if |
Adding
|
Closes #2208.
nix-shell
previously had no way of creating gcroots for shell derivation. This can cause problems if a garbage collection happens concurrently with anix-shell
incantation that runs long enough.nix develop
solves this, as far as I understand it, but--out-link
functionality would still be useful in some circumstances.