nix flake lock doesn't update lock file if flake attribute of an input changes #581

Open
opened 2024-11-20 20:17:06 +00:00 by lheckemann · 0 comments
Member

Describe the bug

If an input of a flake which has flake = false; is modified to remove this, the lockfile isn't updated to match by nix flake lock.

Steps To Reproduce

#!/usr/bin/env bash
set -exuo pipefail

! [[ -e test-flake-lock-flake-attr-change ]] || rm -r test-flake-lock-flake-attr-change
mkdir test-flake-lock-flake-attr-change
cd test-flake-lock-flake-attr-change

cat > flake.nix <<EOF
{
  inputs.systems = {
    url = "github:nix-systems/nix-systems";
    flake = false;
  };
  outputs = _: {};
}
EOF

nix flake lock
cp flake.lock flake.lock.before
sed -i '/flake = false/d' flake.nix
nix flake lock
if diff flake.lock{,.before} ; then
	echo "fail"
	exit 1
fi

Expected behavior

The new flake.lock should differ from the old one, to reflect that b is no longer flake = false;.

nix --version output

nix (Lix, like Nix) 2.92.0-dev-pre20241111-8a90943

Additional context

Add any other context about the problem here.

## Describe the bug If an input of a flake which has `flake = false;` is modified to remove this, the lockfile isn't updated to match by `nix flake lock`. ## Steps To Reproduce ``` #!/usr/bin/env bash set -exuo pipefail ! [[ -e test-flake-lock-flake-attr-change ]] || rm -r test-flake-lock-flake-attr-change mkdir test-flake-lock-flake-attr-change cd test-flake-lock-flake-attr-change cat > flake.nix <<EOF { inputs.systems = { url = "github:nix-systems/nix-systems"; flake = false; }; outputs = _: {}; } EOF nix flake lock cp flake.lock flake.lock.before sed -i '/flake = false/d' flake.nix nix flake lock if diff flake.lock{,.before} ; then echo "fail" exit 1 fi ``` ## Expected behavior The new flake.lock should differ from the old one, to reflect that b is no longer `flake = false;`. ## `nix --version` output nix (Lix, like Nix) 2.92.0-dev-pre20241111-8a90943 ## Additional context Add any other context about the problem here.
lheckemann added the
bug
label 2024-11-20 20:17:07 +00:00
lheckemann added the
Area/flakes
label 2024-11-20 20:57:59 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#581
No description provided.