Describe the bug
Derivations that use passAsFile don't have access to those paths in nix-command nix develop mode.
Steps To Reproduce
$ mkdir -p /tmp/whoops;
$ cd /tmp/whoops;
$ git init;
$ cat <<'EOF' > flake.nix
{
outputs = { nixpkgs, ... }: let
fes = fn: builtins.foldl' ( a: s: a // { ${s} = fn s; } ) {} [
"aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"
];
in {
packages = fes ( system: {
default = nixpkgs.legacyPackages.${system}.stdenv.mkDerivation {
name = "whoops";
data = builtins.concatStringsSep "" ( builtins.genList toString 1024 );
passAsFile = ["data"];
buildCommand = ''
line="$( <"$dataPath"; )";
echo "$line" > "$out";
'';
};
} );
};
}
EOF
$ git add ./flake.nix;
$ nix flake lock;
$ git add ./flake.lock;
$ nix build && cat ./result; # Works
$ rm ./result;
$ nix develop;
$ genericBuild;
bash: /private/tmp/nix-build-whoops-env.drv-0/.attr-1dy8mlivplr3m6ln28k025l0w4ax5kfv4miq9z4qgb1r1xwv0vis: No such file or directory
Expected behavior
Temporary files should be created during devShell initialization.
nix-env --version output
Additional context
The trivial example above uses buildCommand with stdenv.mkDerivation, but the same issue occurs with (unpack|build|install|...)Phase definition, and even with a direct derivation { ... }.
Defining the installable as devShells = ... in the flake has the same behavior as well.
Describe the bug
Derivations that use
passAsFiledon't have access to those paths innix-commandnix developmode.Steps To Reproduce
Expected behavior
Temporary files should be created during devShell initialization.
nix-env --versionoutputAdditional context
The trivial example above uses
buildCommandwithstdenv.mkDerivation, but the same issue occurs with(unpack|build|install|...)Phasedefinition, and even with a directderivation { ... }.Defining the installable as
devShells = ...in the flake has the same behavior as well.