-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix 2.6.0 transitive follows results in an error #6013
Comments
Many flake-based haskell.nix projects are affected by this (see https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html#scaffolding). |
cc. @balsoft |
I just ran into a similar issue in Nix 2.5.1 today where my equivalent to > cd flake-follows-bug-poc2/z
> nix flake metadata
warning: creating lock file '/Users/lily/Dev/Scratch/flake-follows-bug-poc2/z/flake.lock'
warning: Git tree '/Users/lily/Dev/Scratch/flake-follows-bug-poc2' is dirty
Resolved URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=z
Locked URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=z
Path: /nix/store/sh38niscjfvsjmn1hqh1jb3w65jkqcgk-source
Last modified: 2022-01-29 09:37:22
Inputs:
├───a: github:dvzubarev/flake-follows-bug-poc2/91cf8b9a7fcbd349ac54961b0d580d0c98c2d96d?dir=a
│ ├───b: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=b
│ │ ├───c: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=c
│ │ │ └───nixpkgs: github:nixos/nixpkgs/27249995942ba1718f7f05075d44c93bb8e0267c
│ │ └───nixpkgs follows input 'a/nixpkgs'
│ └───nixpkgs follows input 'nixpkgs'
└───nixpkgs: github:nixos/nixpkgs/efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb The > cd flake-follows-bug-poc2/a
> nix flake metadata
warning: updating lock file '/Users/lily/Dev/Scratch/flake-follows-bug-poc2/a/flake.lock':
• Updated input 'b/c/nixpkgs':
follows 'b/nixpkgs'
→ 'github:nixos/nixpkgs/27249995942ba1718f7f05075d44c93bb8e0267c' (2022-02-01)
warning: Git tree '/Users/lily/Dev/Scratch/flake-follows-bug-poc2' is dirty
Resolved URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=a
Locked URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=a
Path: /nix/store/bfkm2bdf6zhmj6pyk8n2qq2s1aqn6b0j-source
Last modified: 2022-01-29 09:37:22
Inputs:
├───b: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=b
│ ├───c: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=c
│ │ └───nixpkgs: github:nixos/nixpkgs/27249995942ba1718f7f05075d44c93bb8e0267c
│ └───nixpkgs follows input 'nixpkgs'
└───nixpkgs: github:nixos/nixpkgs/5bb20f9dc70e9ee16e21cc404b6508654931ce41 Even more bizarrely, after bouncing between the directories and checking > cd flake-follows-bug-poc2/a
> nix flake metadata
warning: Git tree '/Users/lily/Dev/Scratch/flake-follows-bug-poc2' is dirty
warning: updating lock file '/Users/lily/Dev/Scratch/flake-follows-bug-poc2/z/flake.lock':
• Updated input 'a/b/c/nixpkgs':
'github:nixos/nixpkgs/27249995942ba1718f7f05075d44c93bb8e0267c' (2022-02-01)
→ follows 'a/b/nixpkgs'
• Updated input 'a/b/nixpkgs':
follows 'a/nixpkgs'
→ 'github:nixos/nixpkgs/efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb' (2022-01-30)
warning: Git tree '/Users/lily/Dev/Scratch/flake-follows-bug-poc2' is dirty
Resolved URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=z
Locked URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=z
Path: /nix/store/ysby4xpi2ljg9721xfrvx21jz6d4i7sc-source
Last modified: 2022-01-29 09:37:22
Inputs:
├───a: github:dvzubarev/flake-follows-bug-poc2/91cf8b9a7fcbd349ac54961b0d580d0c98c2d96d?dir=a
│ ├───b: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=b
│ │ ├───c: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=c
│ │ │ └───nixpkgs follows input 'a/b/nixpkgs'
│ │ └───nixpkgs: github:nixos/nixpkgs/efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb
│ └───nixpkgs follows input 'nixpkgs'
└───nixpkgs: github:nixos/nixpkgs/efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb Running it again updates > nix flake metadata
warning: Git tree '/Users/lily/Dev/Scratch/flake-follows-bug-poc2' is dirty
warning: updating lock file '/Users/lily/Dev/Scratch/flake-follows-bug-poc2/z/flake.lock':
• Updated input 'a/b/c/nixpkgs':
follows 'a/b/nixpkgs'
→ 'github:nixos/nixpkgs/27249995942ba1718f7f05075d44c93bb8e0267c' (2022-02-01)
warning: Git tree '/Users/lily/Dev/Scratch/flake-follows-bug-poc2' is dirty
Resolved URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=z
Locked URL: git+file:///Users/lily/Dev/Scratch/flake-follows-bug-poc2?dir=z
Path: /nix/store/bx5z8qhq8scivyjb4nb2z80rghd3623d-source
Last modified: 2022-01-29 09:37:22
Inputs:
├───a: github:dvzubarev/flake-follows-bug-poc2/91cf8b9a7fcbd349ac54961b0d580d0c98c2d96d?dir=a
│ ├───b: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=b
│ │ ├───c: github:dvzubarev/flake-follows-bug-poc2/46c67f57ff38672f0fe30e7af33fc5395c5e0730?dir=c
│ │ │ └───nixpkgs: github:nixos/nixpkgs/27249995942ba1718f7f05075d44c93bb8e0267c
│ │ └───nixpkgs: github:nixos/nixpkgs/efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb
│ └───nixpkgs follows input 'nixpkgs'
└───nixpkgs: github:nixos/nixpkgs/efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb This is actually reproducible. If I reset the repo, running My guess here is that the issue with Nix 2.6.0 is related to what I'm describing, perhaps it was a partial fix to the issue I'm showing but that partial fix just results in different broken behavior. |
@lovesegfault Interesting, I didn't realize
So this is still wrong, though different than what |
Ok I just tested Nix 2.6.0, turns out it never even creates a lockfile for |
Poking at Nix 2.6.0 vs Nix 2.5.1 some more and I think you're right, the behavior I'm describing is unrelated. And the fact that Nix 2.5.1's |
I'll take a look |
It's not possible in general to know in computeLocks, relative to which path the follows was intended to be. So, we always resolve follows to their absolute states when we encounter them (which can either be in parseFlakeInput or computeLocks' fake input population). Fixes NixOS#6013 Fixes NixOS#5609 Fixes NixOS#5697 (again)
Resolved in #6036, please test/review |
@balsoft That PR does make this POC work, though the resulting lockfile for "c": {
"inputs": {
"nixpkgs": [
"a",
"b",
"nixpkgs"
]
}, which is curious as it should be able to record |
This doesn't seem harmful, just unexpected, as it means changing |
FTR the behavior on 2.4 was the same:
Since follows in the lockfile are supposed to be relative to the flake root (=absolute). |
Describe the bug
When using a chain of transitive
follows
an error is occurred when creating lock file.Steps To Reproduce
Consider this chain of flakes z -> a -> b -> c.
The goal is to use the same nixpkgs in all packages.
git clone https://github.com/dvzubarev/flake-follows-bug-poc2.git
Expected behavior
I expect that nixpkgs that was set in
z
package will be propagated to all its inputs.It works for
a
package.E.g.
nix-env --version
outputnix-env (Nix) 2.6.0
The text was updated successfully, but these errors were encountered: