Open
Description
Describe the bug
On CI, we were seeing this problem:
Return code: 1
Error output:
these 2 derivations will be built:
/nix/store/313azxr6w777rrgz0lcgkp5f0dlm2nvr-posix-toolchain.drv
/nix/store/qp53d6mv3gs81akp4gv89pk9k7rb76zc-bazel-nixpkgs-posix-toolchain.drv
this path will be fetched (0.09 MiB download, 0.09 MiB unpacked):
/nix/store/cqam21jchkwyp7k0128g6spcx3mzv6p6-bash-5.1-p16-man
error: path '/nix/store/cqam21jchkwyp7k0128g6spcx3mzv6p6-bash-5.1-p16-man' is not valid
This started to happen around the time when nix 2.18.0 was released. Downgrading to 2.17.0 has resolved this problem.
Steps To Reproduce
- clone the daml project:
git clone https://github.com/digital-asset/daml.git
cd daml
git checkout 662a4417912df90ba9d9a99817b8ad9703480d06
# not really needed, also fails for commits from 2021- install nix in single-user mode:
bash <( curl -sSfL https://nixos.org/nix/install ) --no-daemon
- create
path_invalid.nix
:
with import <nixpkgs> { config = {}; overlays = []; };
let
# `packages` might include lists, e.g. `stdenv.initialPath` is a list itself,
# so we need to flatten `packages`.
flatten = builtins.concatMap (x: if builtins.isList x then x else [x]);
env = buildEnv {
name = "posix-toolchain";
paths = flatten [ stdenv.initialPath ];
};
cmd_glob = "${env}/bin/*";
os = if stdenv.isDarwin then "osx" else "linux";
in
runCommand "bazel-nixpkgs-posix-toolchain"
{ executable = false;
# Pointless to do this on a remote machine.
preferLocalBuild = true;
allowSubstitutes = false;
}
''
n=$out/nixpkgs_sh_posix.bzl
mkdir -p "$(dirname "$n")"
cat >>$n <<EOF
load("@rules_sh//sh:posix.bzl", "posix", "sh_posix_toolchain")
discovered = {
EOF
for cmd in ${cmd_glob}; do
if [[ -x $cmd ]]; then
echo " \'$(basename $cmd)\': \'$cmd\'," >>$n
fi
done
cat >>$n <<EOF
}
def create_posix_toolchain():
sh_posix_toolchain(
name = "nixpkgs_sh_posix",
cmds = {
cmd: discovered[cmd]
for cmd in posix.commands
if cmd in discovered
}
)
EOF
''
- run:
DADE_NIXPKGS=$(pwd)/nixpkgs-snapshot
if [[ ! -e "$DADE_NIXPKGS" ]]; then
echo "Loading outdated or missing nixpkgs snapshot..."
outpath="$(
nix-store -Q --realise --indirect --add-root "$DADE_NIXPKGS" \
"$(nix-instantiate -Q --eval "nix/nixpkgs.nix" -A path \
| sed 's/^\"//;s/\"$//')"
)"
echo "Done loading the nixpkgs snapshot to $outpath"
fi
- run:
NIX_PATH=nixpkgs=$DADE_NIXPKGS nix-build path_invalid.nix
Expected behavior
I would expect the nix-build command to succeed.
nix-env --version
output
$ nix-env --version
nix-env (Nix) 2.18.0
Additional context
I have tracked down the error message to
Line 727 in 57eb62d
Priorities
Add 👍 to issues you find important.
Metadata
Metadata
Assignees
Type
Projects
Status
🏁 Review