Open bjornfor opened 2 years ago
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/use-of-nix-build-top-considered-harmful/21443/1
CC bazel and cargo setup hook people: @abbradar @danieldk.
Do you agree with the issue? Who else need to be aware of this issue before we start removing $NIX_BUILD_TOP
from nixpkgs?
I think we should be able to debug builds in the real sandbox or a good approximation of it.
We should accept that nix-shell
has ossified and needs a replacement not just for its role as "dev shell" but also for its role as build debugging shell.
Nonetheless, it's good for Nixpkgs to try to be compatible with usage in dev shells.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/temporary-writable-directory-for-builds/34907/1
Another fix here: https://github.com/NixOS/nixpkgs/pull/266723
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/how-to-look-at-the-build-directory-after-successful-build/14007/3
Describe the bug
Nix expressions that rely on
$NIX_BUILD_TOP
may break undernix-shell
(or when usingnativeBuildInputs = [ keepBuildTree ]
), so let's try to avoid it.Steps To Reproduce
Steps to reproduce the behavior:
$NIX_BUILD_TOP
, e.g.spotifyd
via cargo setup hook:nix-shell -A spotifyd
genericBuild
inside the shell.$NIX_BUILD_TOP
(when the files actually are in$PWD
).Expected behavior
Builds work both with
nix-build
andnix-shell
(not fail in the latter case).Additional context
A workaround for the
nix-shell
breakage could be exporting$NIX_BUILD_TOP
before invoking any build code. (nix develop
has code for that?) But it wouldn't fix thekeepBuildTree
case.Notify maintainers
TODO list
$NIX_BUILD_TOP
. (Some are harmless, need to check them.)