Skip to content
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

Using --override-input fails trying to unpack source even if input has flake = false. #12634

Closed
2 tasks done
vic opened this issue Mar 11, 2025 · 3 comments
Closed
2 tasks done
Labels

Comments

@vic
Copy link

vic commented Mar 11, 2025

Describe the bug

I have a flake where an input is a non-flake url.

inputs = {
    rust-manifest.url = "https://static.rust-lang.org/dist/channel-rust-1.85.0.toml";
    rust-manifest.flake = false;
}

when trying other rust releases via --override-input, nix will always try to unpack the fetched source,
even if the input itself was marked as being a non-flake.

~> nix run github:vic/gleam-nix --override-input rust-manifest "https://static.rust-lang.org/dist/channel-rust-1.75.0.toml"
error:
       … while updating the lock file of flake 'github:vic/gleam-nix/521bba4c6b810c2577d66092e271a190deef2e48?narHash=sha256-du5mAn8Ds9AnCdqhInrgEshSa9pvsMNWwPTW1%2BFjQBE%3D'while updating the flake input 'rust-manifest'while fetching the input 'https://static.rust-lang.org/dist/channel-rust-1.75.0.toml'

       error: Failed to open archive (Unrecognized archive format)

Steps To Reproduce

~> nix run github:vic/gleam-nix --override-input rust-manifest "https://static.rust-lang.org/dist/channel-rust-1.75.0.toml"

Expected behavior

Since nix already loads the flake definition when overriding an input, it should be aware of non-flake inputs and do not try to unpack those sources and simply download them into the store.

Metadata

~> nix-env --version
nix-env (Nix) 2.24.12
~> uname -a
Linux nargun 6.12.17 #1-NixOS SMP PREEMPT_DYNAMIC Thu Feb 27 12:30:24 UTC 2025 x86_64 GNU/Linux

Additional context

None

Checklist


Add 👍 to issues you find important.

@vic vic added the bug label Mar 11, 2025
@vic
Copy link
Author

vic commented Mar 11, 2025

If you think this is a valid issue and makes sense fixing it, I'd love to contribute a PR for it.

@Mic92 Mic92 added feature Feature request or proposal bug and removed bug feature Feature request or proposal labels Mar 12, 2025
@Mic92
Copy link
Member

Mic92 commented Mar 12, 2025

Does this work?

nix run github:vic/gleam-nix --override-input rust-manifest "file+https://static.rust-lang.org/dist/channel-rust-1.75.0.toml"

@vic
Copy link
Author

vic commented Mar 12, 2025

Nice! using file:https:// does work :)

Thank you, @Mic92 !

vic added a commit to vic/gleam-nix that referenced this issue Mar 12, 2025
Using that protocol for rust-manifest in flake.nix will also help people trying to
override the rust version. And prevent them being surprised if nix tried
to unpack the resource, as mentioned in NixOS/nix#12634.
@Mic92 Mic92 closed this as completed Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants