Setting tempdir in nix3-develop, nix3-print-dev-env can lead to issues #979
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#979
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
In the nix3-develop codepath, we set
NIX_BUILD_TOP,TMP, and a bunch of synonyms thereof to a newmktemp -dcreated directory.Diferences from
/tmpThis can lead to subtle bugs because now our
TMPdirectory differs from the normal one in a few ways./tmphas 1777 on my system. But folders created bymktemp -dhave different permissions, eg, 0700TMPdirectory and now your shell is suddenly broken.Bugs
For instance https://github.com/NixOS/nix/issues/10753 was triggered by the following scenario.
rootand setTMPto that. This doesn't have permissions for arbitrary users to create folders in itnixblduser with the sandbox off (since we are using docker)If systemd-tmpfiles deletes your
TMPfolder, then your shell is broken and you need to re source it. This can be painful for users who use tools likehaskell.nixwhich have extremely bad eval times (so users sometimes keep a shell open for months (sic!)). I think there is an issue for this somewhere but I can't find it.OK, I have more bandwidth to think about this.
I'm not so sure yet what is the right way to go about this, basically, we have no guarantees whatsoever about what happens in
/tmpneither.I hear that some users may want to have persistent shells, in that case, those should never be staged in any tmp-ish directory, more like, a conscious choice to choose a persistent shell or not in
/nix/var/nix/shellsor something, and you can have manual GC or automatic GC (not a fan of adding a new GC system for shells).What do you see as solution for your needs?
I think having the option to use manually GC'd temp dir makes sense, and is probably the best thing we can do.
I think this sort of thing is a result of shells expressing tow fundamentally different things: a way to debug a derivation build; and a way to set up development environments. The former needs to recreate an accurate temp dir, while the later doesn't.
@teofilc We looked again at it.
I think the best we can offer is documentation in the future on this because AFAIK, this already works:
already works on HEAD.
I will let you confirm me if there's anything wrong with that, but from my PoV, nix3-develop and nix-shell are consistent on this behavior, solving the inconsistencies.
@raito that sounds like a good workaround to me!
awesome @teofilc ; closing here for now, hopefully, we get a moment to build out better UX for our CLI… thanks for your understanding!