fix(ls-posts): keep cargo out of $HOME so the build is pure unsandboxed #1
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/cargo-home-purity"
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?
nixpkgs' cargoSetupHook sets no
CARGO_HOME, so cargo falls back to itsdefault of
$HOME/.cargoand creates it on any invocation,cargo metadataincluded. Sandboxed that is invisible. Unsandboxed, as on theForgejo runner,
$HOMEis/homeless-shelterand Nix never creates it, socargo makes it for real on the job container's root and Nix refuses to
start every later builder in that job:
error: home directory "/homeless-shelter" exists; please remove it to assure purity of builds without sandboxingThe error names the innocent build, not this one.
.#defaultis asymlinkJoin over ls-posts, i.e. a second builder in the same command, so
it tripped on every run.
Setting
CARGO_HOMEunder$NIX_BUILD_TOPfixes it at the cause rather thanmopping up after it, and needs no sandbox: the Forgejo runner's job
containers cannot sandbox at all -- measured on the box, Nix reports "this
system does not support the kernel namespaces that are required for
sandboxing", and neither
seccomp=unconfinednor a capability short ofSYS_ADMINchanges that.So
.forgejo/workflows/ci.ymldrops itsrm -rf /homeless-shelterdance andits split build, and is now a plain twin of the GitHub one.