Skip to content

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

Merged
ck3d merged 3 commits into
NixOS:masterfrom
MatthewCroughan:mc/pin-installer-registry
Oct 1, 2022
Merged

pin nixpkgs registry to pkgs.path via nix.settings.registry#189113
ck3d merged 3 commits into
NixOS:masterfrom
MatthewCroughan:mc/pin-installer-registry

Conversation

@MatthewCroughan

@MatthewCroughan MatthewCroughan commented Aug 31, 2022

Copy link
Copy Markdown
Contributor
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 This PR causes between 1 and 10 packages to rebuild on Linux. labels Aug 31, 2022
@pennae

pennae commented Aug 31, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

pennae commented Aug 31, 2022

Copy link
Copy Markdown
Contributor

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

bbjubjub2494 commented Aug 31, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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

@bbjubjub2494

bbjubjub2494 commented Sep 1, 2022

Copy link
Copy Markdown
Member

@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;
};

Comment thread nixos/modules/installer/cd-dvd/channel.nix Outdated
Comment thread nixos/modules/installer/cd-dvd/channel.nix Outdated
@MatthewCroughan MatthewCroughan force-pushed the mc/pin-installer-registry branch from 6a7eefe to 31dbd4c Compare September 26, 2022 15:24

@ck3d ck3d left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread nixos/modules/installer/cd-dvd/channel.nix Outdated
Co-authored-by: Louis Bettens <lourkeur@users.noreply.github.com>

@bbjubjub2494 bbjubjub2494 left a comment

Copy link
Copy Markdown
Member

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 persons. label Sep 26, 2022
@bobby285271 bobby285271 added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 2 This PR was reviewed and approved by two persons. 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 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants