crane icon indicating copy to clipboard operation
crane copied to clipboard

crane builds create /homeless-shelter files which breaks nix

Open pcarrier opened this issue 9 months ago • 2 comments

Operations fail because of:

error: home directory '/homeless-shelter' exists; please remove it to assure purity of builds without sandboxing

/homeless-shelter contains:

/homeless-shelter
/homeless-shelter/.cargo
/homeless-shelter/.cargo/.package-cache
/homeless-shelter/.cargo/.global-cache
/homeless-shelter/.cargo/.package-cache-mutate

This is produced while evaluating a flake containing:

            jaiminho = (crane.mkLib pkgs).buildPackage {
              src = ./jaiminho;
              pname = "jaiminho";
              version = "0.0.0";
              cargoExtraArgs = "-p jaiminho_cli";
              nativeBuildInputs = with pkgs; [
                cmake
                nasm
              ];
              strictDeps = true;
              doCheck = false;
            };

on a daemonless Nix as root inside docker whose image is built with:

              trampolineBase = pkgs.dockerTools.buildImage {
                name = "trampoline-base";
                copyToRoot = pkgs.buildEnv {
                  name = "trampoline-base-root";
                  paths = [
                    pkgs.dockerTools.caCertificates
                    pkgs.dockerTools.fakeNss
                    pkgs.git
                    pkgs.nix
                    pkgs.bash
                    pkgs.busybox
                  ];
                  pathsToLink = [
                    "/bin"
                    "/etc"
                  ];
                };
              };

pcarrier avatar Mar 19 '25 09:03 pcarrier

Worked around by disabling sandbox, but keeping around as FYI.

pcarrier avatar Mar 19 '25 12:03 pcarrier

Hi @pcarrier thanks for the report! Could you please provide a(n ideally minimal,) and self-contained flake that reproduces the problem? It's hard to investigate this further from just a snippet

ipetkov avatar Mar 19 '25 14:03 ipetkov