NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.75k stars 1.52k forks source link

extra-sandbox-paths doesn't have the same handling of ? as sandbox-paths #5210

Open kittywitch opened 3 years ago

kittywitch commented 3 years ago

Describe the bug

The documentation for sandbox-paths states:

If source is followed by ?, then it is not an error if source does not exist; for example, /dev/nvidiactl? specifies that /dev/nvidiactl will only be mounted in the sandbox if it exists in the host filesystem.

extra-sandbox-paths (at least, as far as I can tell), does not allow you to provide this operator to get the same behaviour. I have not verified whether or not sandbox-paths has the behavior stated, but the manual says that it should. I think that extra-sandbox-paths should also have this behavior.

Steps To Reproduce

  1. Add something like provided below, where the sandbox paths do not actually exist yet in the store.

    extra-sandbox-paths = with pkgs; toString( map (package: "${package}?") [bash qemu]);
  2. The build will fail due to the non-existence despite the ?.

Expected behavior

It does not fail to build because it cannot find the path that the package points to, because the ? overrides it erroring.

nix-env --version output

nix-env (Nix) 2.3.15

Additional context

Encountered under CI with run provided, commit provided. Error provided also. https://github.com/kittywitch/nixfiles/runs/3492653835 (see nix setup) https://github.com/kittywitch/nixfiles/commit/97c7bd5ec33b7b88cda3e097cae51df57234f301

error: while setting up the build environment: getting attributes of path '/nix/store/r0pswys68sglqbx1s8ffypyaxa94w8g1-qemu-6.0.0': No such file or directory

Nix config file obtained from CI:

cores = 0
extra-platforms = aarch64-linux
extra-sandbox-paths = /nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23? /nix/store/2wpv3jdas3j9gpki5872j5dl76vp5jnv-qemu-6.0.0? /run/binfmt?
fsync-metadata = false
http2 = false
max-jobs = 8
max-silent-time = 1800
substituters = https://arc.cachix.org https://kittywitch.cachix.org https://cache.nixos.org/
trusted-public-keys = arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY= kittywitch.cachix.org-1:KIzX/G5cuPw5WgrXad6UnrRZ8UDr7jhXzRTK/lmqyK0= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY
use-sqlite-wal = true
stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

kittywitch commented 2 years ago

De-staling this issue