Skip to content

nix-shell fails to realise a derivation's source inputs when they exist only in the eval-store #16297

Description

@sinrohit-desco

Describe the bug

When running nix-shell with --eval-store pointing to a store different from the build store (--store), realisation fails if any of the derivation's source inputs (e.g. src) exist only in the eval store:

don't know how to build these paths:
  /nix/store/bzrr5cm5spscmzha55hpnza5x7s06g91-src.txt
error: path '/nix/store/bzrr5cm5spscmzha55hpnza5x7s06g91-src.txt' is required, but there is no substituter that can build it

Steps To Reproduce

#!/usr/bin/env bash
set -uo pipefail

root=$(mktemp -d)
build_store="$root/build"
eval_store="$root/eval"

export NIX_BUILD_SHELL="$(command -v bash)"

printf 'repro-%s\n' "$RANDOM" >"$root/src.txt"

cat >"$root/repro.nix" <<EOF
derivation {
  name    = "eval-store-shell";
  system  = builtins.currentSystem;
  builder = "/bin/sh";
  args    = [ "-c" "echo hello > \$out" ];
  src     = $root/src.txt;
}
EOF

nix-shell --option substituters '' \
  --store "$build_store" --eval-store "$eval_store" \
  --run true "$root/repro.nix"

Expected behavior

nix-shell should work with --eval-store

Metadata

nix-env --version
nix-env (Nix) 2.35.1

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions