Skip to content

fix: remove flake-parts nixpkgs-lib follows nixpkgs#2680

Merged
mightyiam merged 1 commit into
molybdenumsoftware:masterfrom
Lymah123:fix/flake-parts-nixpkgs-lib-follows
Jul 2, 2026
Merged

fix: remove flake-parts nixpkgs-lib follows nixpkgs#2680
mightyiam merged 1 commit into
molybdenumsoftware:masterfrom
Lymah123:fix/flake-parts-nixpkgs-lib-follows

Conversation

@Lymah123

@Lymah123 Lymah123 commented Jul 2, 2026

Copy link
Copy Markdown

flake-parts has its own nixpkgs-lib input from which it inherits lib. This repo was overriding that with inputs.nixpkgs-lib.follows = "nixpkgs", routing it through statix's own nixpkgs. Since nixpkgs has flake = false, it's a bare source tree with no flake outputs, so flake-parts fails to find nixpkgs-lib.lib and evaluation errors immediately.

Removing the follows lets flake-parts use its own pinned nixpkgs-lib, which is a proper flake. This fixes the nixpkgs bump failure reported in #2677

@Lymah123 Lymah123 marked this pull request as ready for review July 2, 2026 05:48
@Lymah123

Lymah123 commented Jul 2, 2026

Copy link
Copy Markdown
Author

@mightyiam, the PR is ready for review.

@mightyiam

Copy link
Copy Markdown
Member

Thank you for looking into this, @Lymah123. The solution in this PR is indeed a valid one, but I'd like to clarify the root cause, verbosely:

The problem is a discrepency between the flake.nix and the flake.lock. The flake.nix specifies nixpkgs with flake=false, while the flake.lock does not, defaulting to flake=true.

This can easily occur because, unlike other changes to inputs, changes to the flake attribute are not picked up and applied to the flake.lock by various flake commands. It is reported as NixOS/nix#8511.

Apparently, flake-parts needs a nixpkgs input that is a flake. What occurs in PRs that merely bump Nixpkgs, is that they trigger the propagation of flake=false into the flake.lock, at which point nixpkgs ends up not being a flake, resulting in flake-parts failing to evaluate.

Now, nixpkgs is an input that does not have any of its own flake inputs, so we don't mind keeping it flake=true. That, would be a slightly more efficient solution, because then we would not end up with an additional input in the lockfile.

@Lymah123

Lymah123 commented Jul 2, 2026

Copy link
Copy Markdown
Author

Thank you for looking into this, @Lymah123. The solution in this PR is indeed a valid one, but I'd like to clarify the root cause, verbosely:

The problem is a discrepency between the flake.nix and the flake.lock. The flake.nix specifies nixpkgs with flake=false, while the flake.lock does not, defaulting to flake=true.

This can easily occur because, unlike other changes to inputs, changes to the flake attribute are not picked up and applied to the flake.lock by various flake commands. It is reported as NixOS/nix#8511.

Apparently, flake-parts needs a nixpkgs input that is a flake. What occurs in PRs that merely bump Nixpkgs, is that they trigger the propagation of flake=false into the flake.lock, at which point nixpkgs ends up not being a flake, resulting in flake-parts failing to evaluate.

Now, nixpkgs is an input that does not have any of its own flake inputs, so we don't mind keeping it flake=true. That, would be a slightly more efficient solution, because then we would not end up with an additional input in the lockfile.

Thank you for the detailed explanation. So the inconsistency between flake.nix (flake = false) and flake.lock (still flake = true) is the actual root cause, with nixpkgs bumps being the trigger that forces the lockfile to catch up and propagate flake = false, breaking flake-parts at that point. Will update the PR to remove flake = false from nixpkgs instead, keeping the follows in place to avoid the extra lockfile entry.

@Lymah123 Lymah123 force-pushed the fix/flake-parts-nixpkgs-lib-follows branch from df29247 to 0acd6d6 Compare July 2, 2026 23:37
@Lymah123 Lymah123 force-pushed the fix/flake-parts-nixpkgs-lib-follows branch from 0acd6d6 to ba566f3 Compare July 2, 2026 23:39
@mightyiam mightyiam enabled auto-merge (squash) July 2, 2026 23:40
@mightyiam

Copy link
Copy Markdown
Member

I think that the conventional commits type fix is for fixes that are user facing. So I squashed with chore.

@mightyiam mightyiam merged commit ea040be into molybdenumsoftware:master Jul 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants