Open NobbZ opened 2 years ago
I can indeed reproduce this. More self-contained repro:
#!/usr/bin/env bash
set -euo pipefail
set -x
rm -rf A B C D
mkdir -p A B C D
cat <<EOF > A/flake.nix
{ outputs = _: {}; }
EOF
cat <<EOF > B/flake.nix
{
inputs.A.url = "path:$PWD/A";
outputs = _: {};
}
EOF
cat <<EOF > C/flake.nix
{
inputs.B.url = "path:$PWD/B";
outputs = _: {};
}
EOF
cat <<EOF > D/flake.nix
{
inputs.C.url = "path:$PWD/C";
inputs.A.url = "path:$PWD/A";
inputs.C.inputs.B.inputs.A.follows = "A";
outputs = _: {};
}
EOF
nix flake update ./D
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
may have been fixed in https://github.com/NixOS/nix/pull/6036
Nope. Running thuf's script still fails:
$ nix shell github:NixOS/nix\#nix
$ ./tempscript
+ rm -rf A B C D
+ mkdir -p A B C D
+ cat
+ cat
+ cat
+ cat
+ nix flake update ./D
error: cannot find flake 'flake:B' in the flake registries
(use '--show-trace' to show detailed location information)
$ nix --version
nix (Nix) 2.7.0pre20220211_4d67ecb
The desired change to the resulting lockfile for the relevant "follows" line,
inputs.C.inputs.B.inputs.A.follows = "A";
should cause this:
diff --git a/flake.lock b/flake.lock.post
index 7d50628..c51a7d1 100644
--- a/flake.lock
+++ b/flake.lock.post
@@ -26,7 +26,7 @@
},
"B": {
"inputs": {
- "A": "A_2"
+ "A": ["A"]
},
"locked": {
"lastModified": 1654174365,
I've tried a few combination such as bringing B to the top and they trying to override it:
{
inputs.B.follows = "C/B";
inputs.B.inputs.A.follows = "A";
outputs = _: {};
}
but then the relevant line to follow A has no effect.
What does work is to bring everything to the top level:
{
inputs.A.follows = "C/B/A";
inputs.B.follows = "C/B";
outputs = _: {};
}
This can work in some cases if all you need is top level access to those inputs, but it does not allow you to change them, which is where people run into this problem.
Perhaps this issue can be reopened as #6621 was reverted in favor of #6530
Have you found any work-around for this?
@azazel75, yes, I now use flake-compat
and import
+ custom logic for making inputs
and outputs
. I reduced flake.lock
sizes significantly and made flakes very flexible, but now have to write a bit of boilerplate and can't nix flake archive
to cache flake inputs transitively.
https://github.com/deemp/flakes/blob/main/flake.nix https://github.com/deemp/flakes/blob/main/flakes-tools/flake.nix
Describe the bug
I want to use
follows
on the input of an input.Though I get an error, that this is not in the registry.
Steps To Reproduce
nixpkgs
input to aflake.nix
.flake.nix
at appropriate location:flake.lock
and observe error:Expected behavior
The
nixpkgs
input of thenaersk
input ofrnix-lsp
is properly overwritten and follows "my"nixpkgs
.nix-env --version
outputAdditional context
I tried this as a way to workaround #5609.
The same problem happens on 2.4 and 2.5: