[Nix#9642] Nix fails to lock a GitHub flake reference if the repository does not include the flake.lock file #80

Open
opened 2024-03-16 06:44:48 +00:00 by lix-bot · 0 comments
Member

Upstream-Issue: NixOS/nix#9642

Describe the bug

If a GitHub flake reference has an input but doesn't come with a flake.lock file then the Nix command fails with:

error:
       … while updating the lock file of flake 'github:…'

       error: cannot write modified lock file of flake 'github:…' (use '--no-write-lock-file' to ignore)

Steps To Reproduce

$ nix eval 'github:Gabriella439/lockbug/4eeaa17033855402a987ba71cfe21257c7e2cf29#default'
error:
       … while updating the lock file of flake 'github:Gabriella439/lockbug/4eeaa17033855402a987ba71cfe21257c7e2cf29'

       error: cannot write modified lock file of flake 'github:Gabriella439/lockbug/4eeaa17033855402a987ba71cfe21257c7e2cf29' (use '--no-write-lock-file' to ignore)

Expected behavior

I expect the command to succeed even if the repository's flake doesn't include a lock file.

nix-env --version output

Additional context

It appears that what's happening is that when Nix encounters the GitHub flake with a missing flake.lock file it attempts to lock it, but it can't because the GitHub repository is an immutable /nix/store/…-source path by that point.

This also seems a bit similar to:

https://github.com/NixOS/nix/issues/6050

… although that's not for a GitHub flake reference so it's not clear if it's the same problem or not.

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/9642 **Describe the bug** If a GitHub flake reference has an input but doesn't come with a `flake.lock` file then the Nix command fails with: ``` error: … while updating the lock file of flake 'github:…' error: cannot write modified lock file of flake 'github:…' (use '--no-write-lock-file' to ignore) ``` **Steps To Reproduce** ```ShellSession $ nix eval 'github:Gabriella439/lockbug/4eeaa17033855402a987ba71cfe21257c7e2cf29#default' error: … while updating the lock file of flake 'github:Gabriella439/lockbug/4eeaa17033855402a987ba71cfe21257c7e2cf29' error: cannot write modified lock file of flake 'github:Gabriella439/lockbug/4eeaa17033855402a987ba71cfe21257c7e2cf29' (use '--no-write-lock-file' to ignore) ``` **Expected behavior** I expect the command to succeed even if the repository's flake doesn't include a lock file. **`nix-env --version` output** **Additional context** It appears that what's happening is that when Nix encounters the GitHub flake with a missing `flake.lock` file it attempts to lock it, but it can't because the GitHub repository is an immutable `/nix/store/…-source` path by that point. This also seems a bit similar to: https://github.com/NixOS/nix/issues/6050 … although that's not for a GitHub flake reference so it's not clear if it's the same problem or not. **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
bug
imported
labels 2024-03-16 06:44:48 +00:00
jade added the
Area/flakes
label 2024-03-30 00:06:39 +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#80
No description provided.