-
-
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
libfetchers/tarball: Lock on effectiveUrl #4595
Conversation
Basically, if a tarball URL is used as a flake input, and the URL leads to a redirect, the final redirect destination would be recorded as the locked URL. This allows tarballs under https://nixos.org/channels to be used as flake inputs. If we, as before, lock on to the original URL it would break every time the channel updates.
This feature is intended to support the use of good old See Discourse: https://discourse.nixos.org/t/future-of-channels-and-channels-nixos-org-in-a-flakes-world/11563, relevant parts copied here for convenience: I feel that less reliance on GitHub for releases might be a good idea. If we decide to leave GitHub some day for some reason, it would be nice if we don't suddenly leave countless mentions of So maybe we should add a way to refer to good old channels in a Flake URL? Here's a possible way that I thought of:
This way specifying: inputs.nixpkgs.url = "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"; Would actually just work, as instead of failing with an invalid hash whenever {
"nodes": {
"nixpkgs": {
"locked": {
"narHash": "sha256-N1qI50AkeTSBp1ffUCHrcK2re52wrn6euFFGGvFa2iw=",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-21.05pre269929.ff96a0fa563/nixexprs.tar.xz"
},
"original": {
"type": "tarball",
"url": "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"
}
},
// ...
} This way, older versions of Nix seeing this new lock file would just behave as if someone used |
Thanks, merged it. However, I don't think we should fetch the nixpkgs flake via channels.nixos.org, since it doesn't provide the Git revision that the
This can be avoided by relying on the |
Yeah, it does seem to work fine, and given that a (non-indirect) flake url represents where the flake is, |
@edolstra @dramforever I think this broke downloading github releases as they redirect to signed url:s which expire at some point. |
Ah shoot... I'd be fine if this were reverted |
Basically, if a tarball URL is used as a flake input, and the URL leads
to a redirect, the final redirect destination would be recorded as the
locked URL.
This allows tarballs under https://nixos.org/channels to be used as
flake inputs. If we, as before, lock on to the original URL it would
break every time the channel updates.