nix-build/nix-shell tmpdir unnecessarily long #1044
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
awaiting
author
awaiting
contributors
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1044
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?
TMPDIR=/tmp/nix-shell-31cm5aj8fp7p0395f0lb055n23/build-top-3n5jpa6cl9nszvxjl8kmjnc4hnis an unnecessarily long tempdir for builds or shells. the second random bit is unnecessary because the first random bit already guarantees uniqueness. this is ironic because the change to this happened to make darwin paths shorter for unix socket reasons, but now anything built in a shell that places unix sockets in a tmpdir only has 30(ish) bytes total for the unix socket path where previously it could have had a lot morecc @emilazy
We get very different values with
nix-shellthan withnix-build.nix-build -E 'with import <nixpkgs> { }; runCommand "foo" { } "declare -p TMPDIR"'yieldsdeclare -x TMPDIR="/nix/var/nix/b/0fkd0xmsly1p4pqf6fi05isy1s", butnix-shell --run 'declare -p TMPDIR' -pyields that long as fuck path on Linux, but on my macOS machine it yields my normal shell'sTMPDIR, unless I unset it firstThis is due to my nix-shell's fixes,
$NIX_BUILD_TOPis a temporary directory in the tmpDirRoot now if no$TMPDIRis provided to avoid the fallback on/tmp, causing things like/tmp/env-varsto be written and breaking the shell.We could rebase the build top directory one directory above, there's nothing that forces it to live inside tmpDirRoot per se, saving 36 chars again.
we could also call it just
build-topinstead of appending a long-ass random string, that would also help a lot