-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Cache flake-registry #6750
Cache flake-registry #6750
Conversation
7218653
to
e1a2c06
Compare
You wouldn't be able to document this in the changelog, would you? I'm away from my clone at the moment but I believe it's in |
flake.lock
Outdated
"locked": { | ||
"narHash": "sha256-Wz8gOVJbyCBrRXuBot9IEsdzIPnu2ZRl3uH9+D3/uIc=", | ||
"type": "file", | ||
"url": "https://channels.nixos.org/flake-registry.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't lock this file because it's mutable and not a redirect. Probably better to use the underlying git repo (https://github.com/NixOS/flake-registry).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edolstra Do my latest changes resolve this concern?
4844c71
to
1a134c1
Compare
5b72ba1
to
eeb23b7
Compare
The change looks good. I'm curious what the use-case is otoh. Isn't the registry file fetched (and updated) on-the-fly anyways in the image? |
@thufschmitt I am using nix in various CI pipelines. The #6686 contains changes which address the problem. This PR is to ensure that the flake registry is cached also. |
eeb23b7
to
8f88172
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking about this PR for few days now and I'm not 100% this should be merged. But of course I might be wrong as I was many times :)
It is important to know that the purpose of this Docker image is to give a users (especially new users) a great Nix experience while still running it in the familiar Docker container.
Looking at the old Nix commands it is expected that nixpkgs channel is set and correct NIX_PATH is set. This is not anymore true for new Nix commands. The expected behavior is actually that the last nixpkgs is going to be used. That also implies that latest flake-registry revision should be used.
Now I do understand that for CI it would be nice cache this. But I think the change might produce some unexpected results (eg. not really using the latest versions of flake-registry and nixpkgs.
I'm wonder if we can somehow work around to make both use cases work?
@garbas I closed #6686 and opened #6831.
I have a single GitLab project with a single Luckily, all these software applications are contained within a single flake, which ensures that the same commit of nixpkgs will be used everywhere. However, this is just one GitLab project. We have ~250 GitLab projects. It seems highly unlikely that every project across the organization will use the same nixpkgs commit in its I am doing R&D on different approaches to try and ameliorate these issues. It might very well be that caching the flake registry and nixpkgs is not the way to go, in which case I will close these PRs. |
8f88172
to
7bfe38b
Compare
Triaged in the Nix team meeting 2023-03-17: We're not sure what the tradeoffs are. |
I can see adding the functionality to @centromere Would that be OK compromise for you? |
I've merged current master, resolved conflicts and made |
Looks good, @garbas. Thank you! |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-03-17-nix-team-meeting-minutes-41/26614/1 |
This change permits the flake registry to be included in the resulting Docker image.