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

pin nixpkgs registry to pkgs.path via nix.settings.registry #189113

Merged
merged 3 commits into from
Oct 1, 2022

Conversation

MatthewCroughan
Copy link
Contributor

@MatthewCroughan MatthewCroughan commented Aug 31, 2022

Description of changes

This is a suggestion of something that would be needed in order to allow #189048 to function correctly. Otherwise the registry entry the user's nix will generate when faced with a /etc/nixos/flake.nix that does not contain an inputs attribute, will be ambigious and non-reproducible. We set the nix-channel appropriately in channel.nix for this same reason.

I provide two commits for doing this, and I'm not sure which approach is better.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Aug 31, 2022
@MatthewCroughan MatthewCroughan changed the title nixos/modules/installer/cd-dvd/channel.nix: pin nixpkgs registry entr… pin nixpkgs registry to pkgs.path via nix.settings.registry Aug 31, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Aug 31, 2022
@pennae
Copy link
Contributor

pennae commented Aug 31, 2022

this would be much better done in flake.nix by setting nix.registry.nixpkgs.flake = nixpkgs, and nixPath also needs set appropriately

@MatthewCroughan
Copy link
Contributor Author

@pennae That doesn't solve anything. If you run nix shell nixpkgs#foo from a live CD, it will grab the latest nixpkgs master, unless this PR is merged. What you're talking about only takes effect after the generation you're suggesting, is activated.

@pennae
Copy link
Contributor

pennae commented Aug 31, 2022

ah, mistakenly thought this piece also goes into the installed system. that'll also obviate the nixPath change then since it'll already be set correctly. :)

@bbjubjub2494
Copy link
Member

bbjubjub2494 commented Aug 31, 2022

I support the idea. Does not work on my machine:

error: attribute 'outPath' missing

       at /nix/store/1ygz8a75ds7rwfpixmwwcr67pj0czxmh-nixpkgs-patched-a63021a/nixos/modules/services/misc/nix-daemon.nix:436:26:

          435|                   type = "path";
          436|                   path = config.flake.outPath;
             |                          ^
          437|                 } // filterAttrs
(use '--show-trace' to show detailed location information)

outputs typically doesn't return an outPath.

For the record I'm building a custom iso but I don't think that makes a difference.

@MatthewCroughan
Copy link
Contributor Author

@lourkeur does the commit I just pushed, fix anything? This would have been much easier if #167947 wasn't reverted.

@bbjubjub2494
Copy link
Member

bbjubjub2494 commented Sep 1, 2022

@MatthewCroughan nope. Same error.

I'd love to help better but I'm out of my depth with the flakes magic. I would like this to be possible other than setting to to a path directly...

nix.registry.nixpkgs.to = {
  type = "path";
  path = pkgs.path;
};

@MatthewCroughan MatthewCroughan force-pushed the mc/pin-installer-registry branch from 6a7eefe to 31dbd4c Compare September 26, 2022 15:24
Copy link
Contributor

@ck3d ck3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please squash the commits

Co-authored-by: Louis Bettens <lourkeur@users.noreply.github.com>
Copy link
Member

@bbjubjub2494 bbjubjub2494 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good afaiac

@bobby285271 bobby285271 added the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Sep 26, 2022
@bobby285271 bobby285271 added 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people and removed 12.approvals: 2 This PR was reviewed and approved by two reputable people labels Sep 27, 2022
@ck3d ck3d merged commit a682390 into NixOS:master Oct 1, 2022
@MatthewCroughan MatthewCroughan deleted the mc/pin-installer-registry branch October 2, 2022 00:27
@Izorkin Izorkin mentioned this pull request Oct 20, 2022
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants