treewide: use writableTmpDirAsHomeHook#378110
Conversation
59cff8b to
d6fbdc1
Compare
d6fbdc1 to
ab37260
Compare
GaetanLepage
left a comment
There was a problem hiding this comment.
LGTM, thanks for this !
ab37260 to
194aeb2
Compare
194aeb2 to
71cfe3b
Compare
| nativeCheckInputs = [ | ||
| writableTmpDirAsHomeHook | ||
| ]; |
There was a problem hiding this comment.
I find that this pattern does not work for go packages. The writableTmpDirAsHome bash function is never called and $HOME remains to be HOME=/homeless-shelter. Any ideas? cc @ShamrockLee
There was a problem hiding this comment.
Have you tried recently ?
The hook was initially broken but got fixed afterwards.
There was a problem hiding this comment.
Is this the right commit ?
There was a problem hiding this comment.
It works if I do one of these things:
- also add
writableTmpDirAsHomeHooktocheckInputs - disable
strictDeps:nix-repl> :b apx.overrideAttrs { strictDeps = false; }
There was a problem hiding this comment.
To be honest, I have no clue who to contact. Can you ping the relevant nicknames here perhaps?
There was a problem hiding this comment.
@NixOS/stdenv @NixOS/golang @infinisil @roberth Sorry for bothering, but does anyone know why setup hooks using addEnvHooks "$targetOffset" don't take effect when passing to buildGoModule?
There was a problem hiding this comment.
@NickCao told me how setup hooks work and why this issue happens only for go packages here. Thank you, @NickCao .
The following patch fixes it:
-addEnvHooks "$targetOffset" writableTmpDirAsHome
+addEnvHooks "$hostOffset" writableTmpDirAsHomeHere is the explanation. Assume writableTmpDirAsHomeHook is added to nativeBuildInputs (or nativeCheckInputs). If hostOffset is used, the bash function writableTmpDirAsHome is run against each dependency in depsBuildBuild depsBuildHost(nativeBuildInputs) depsBuildTarget. If targetOffset is used, it is run against each dependency in depsHostHost depsHostTarget(buildInputs). Go packages usually have no dependencies in depsHostHost depsHostTarget(buildInputs), so the bash function writableTmpDirAsHome is never run and we observe this issue. Since we assume writableTmpDirAsHomeHook is added to nativeBuildInputs, there is at least one dependency (the hook itself) in depsBuildBuild depsBuildHost(nativeBuildInputs) depsBuildTarget. As a result, the bash function writableTmpDirAsHome will always run when hostOffset is used.
The implementation of addEnvHooks may be helpful.
There was a problem hiding this comment.
Thank you for making the investigation, very interesting !!!
Reference to #370869
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.