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

nix.registry.nixpkgs.to.path defined multiple times within nix-darwin itself #1082

Closed
sellout opened this issue Sep 17, 2024 · 9 comments · Fixed by #1083
Closed

nix.registry.nixpkgs.to.path defined multiple times within nix-darwin itself #1082

sellout opened this issue Sep 17, 2024 · 9 comments · Fixed by #1083

Comments

@sellout
Copy link
Contributor

sellout commented Sep 17, 2024

8714f9e is a breaking change. When I darwin-rebuild build at or after this commit, I get the following error.

error: The option `nix.registry.nixpkgs.to.path' is defined multiple times while it's expected to be unique.

Definition values:
- In `/nix/store/bf…4i-source/modules/nix': "/nix/store/4a…rx-source"
- In `/nix/store/bf…4i-source/modules/nix/nixpkgs-flake.nix'
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

Both of these locations use mkDefault, but the latter was added just a week ago in 8714f9e.

My config sets nix.registry.nixpkgs.flake = inputs.nixpkgs. Removing that setting allows my configuration to build, but the issue is that my nix.registry and nix.settings are shared between my configs for nix-darwin, NixOS, and Home Manager. This change seems to make it so I can’t share them (or at least all of them) any more.

But perhaps there is some other change I can make to the config to maintain cross-compatibility?

@emilazy
Copy link
Collaborator

emilazy commented Sep 17, 2024

Yeah, NixOS does something quite bad here and we inherited it, but slightly different, in a way that breaks things…

Ideally the NixOS module should be improved but please try #1083 which should make us suboptimal in the same way. Sorry for not catching this before the merge.

@mcgilly17
Copy link

Thanks for the quick update @emilazy, and thank you for your work on nix-darwin! With the latest update, are we then safe to upgrade to sequoia if we have run a build prior to upgrading?

@emilazy
Copy link
Collaborator

emilazy commented Sep 18, 2024

As long as you see the darwin-rebuild switch error message, run the command it quotes, and manage to successfully darwin-rebuild switch after that, you should be good to upgrade.

@mcgilly17
Copy link

Worked like a charm. Thanks @emilazy.

@emilazy
Copy link
Collaborator

emilazy commented Sep 18, 2024

Uh, I just noticed this is on the Nixpkgs flake registry pinning stuff. Not sure if you intended to comment here but it’s not related to the Sequoia update at all, FWIW :)

@antoineco
Copy link
Contributor

@sellout not a long-term solution, but if you set nixpkgs.registry.nixpkgs.flake manually, I believe that the most sensible path to avoid your error for now is to additionally set:

  nixpkgs.flake = {
    setFlakeRegistry = false;
    setNixPath = false;
  };

@mcgilly17
Copy link

mcgilly17 commented Sep 19, 2024

Uh, I just noticed this is on the Nixpkgs flake registry pinning stuff. Not sure if you intended to comment here but it’s not related to the Sequoia update at all, FWIW :)

Oh right, sorry @emilazy. The error ocurred at the same time as I was going through the upgrade process for sequoia. I assumed incorrectly that they were connected! It is all working now, which is fantastic.

@evelant
Copy link

evelant commented Sep 20, 2024

@antoineco What does adding that config do? Any potential problems to look out for when doing that?

@antoineco
Copy link
Contributor

antoineco commented Sep 20, 2024

@evelant it will prevent nix-darwin from adding:

  1. A custom entry for nixpkgs to the Nix registry that points to the store path of the nixpkgs source that was used to build your current system revision. (By default, nixpkgs is a symbolic reference to github:NixOS/nixpkgs/nixpkgs-unstable.)

    Mostly useful if you want nix run 'nixpkgs#something' to run packages from the same nixpkgs revision as you used in nix-darwin

  2. The entry nixpkgs=flake:nixpkgs to your NIX_PATH, which is directly related to the registry reference above.

    Mostly useful if you rely on the "legacy" <nixpkgs> lookup path in some places but have channels explicitly disabled. E.g. import <nixpkgs> in a shell.nix. If you only use flakes, this is irrelevant.

tomaskala added a commit to tomaskala/infra that referenced this issue Sep 23, 2024
Needed this to get the fix LnL7/nix-darwin#1082
NoahBres pushed a commit to NoahBres/nix-darwin that referenced this issue Oct 7, 2024
ahirner added a commit to ahirner/nix-trickle that referenced this issue Oct 17, 2024
ahirner added a commit to ahirner/nix-trickle that referenced this issue Oct 17, 2024
arulagrawal added a commit to arulagrawal/nix-darwin that referenced this issue Oct 22, 2024
* fix: initdb missing data area directory

Use `PGDATA` environment variable instead of `-D` to maintain
consistency with NixOS module.

Co-Authored-By: Michael Hoang <enzime@users.noreply.github.com>

* Use the correct file location for `SoftwareUpdate` plist.

* flake: match NixOS definition of `nixpkgs.flake.source`

Closes: LnL7#1082

* feat: use wait4path with script launchd option

addresses LnL7#1043

fix: use exec in launchd daemon config

fix: dont use a script thats in the nix store

fix: remove manual wait4path in linux-builder

fix: remove manual wait4path in karabiner elements

fix: remove manual wait4path in nix-daemon

fix: remove manual wait4path in nix-optimise

fix: remove manual wait4path in tailscaled

fix: autossh test

Revert "fix: remove manual wait4path in nix-daemon"

This reverts commit 6aec084.

fix: remove bad exec

Reapply "fix: remove manual wait4path in nix-daemon"

This reverts commit c8f136e.

fix: update autossh test

to reflect changes in f86e613

fix: services-activate-system-changed-label-prefix test

fix: services-buildkite-agent test

fix: services-activate-system test

fix: escape ampersand

fix: services-lorri test

fix: services-nix-optimise test

fix: services-nix-gc test

refactor: use script rather than command in daemon

fix: use config.command for clarity

style: fix indentation

fix: use lib.getExe rather than directly pointing to file

revert: a87fc7b

- mistaken refactor meant that service waited for nix store and not the relevant path

* fix: karabiner elements virtualhiddeviceclient

- command needed to be quoted

* Adding option for slow-motion-allowed;

This was inspired by a recent Daring Fireball post where I was reminded about
this feature and how it's missing from being able to configure it in Nix-Darwin.

[https://daringfireball.net/linked/2024/09/28/hidden-pref-to-restore-slow-motion-dock-minimizing-on-macos]()

* fix: remove deprecated lib.mdDoc

* add JankyBorders option order and set below by default (values: above/below)

* Update modules/services/jankyborders/default.nix

Co-authored-by: Michael Hoang <Enzime@users.noreply.github.com>

* push change to jankyborders test

* netdata: add netdata service in nix-darwin.

* programs/bash: move to completion.*

a port of NixOS/nixpkgs#291552 for darwin

* defaults: don't output Dock PID

* skhd: add `skhd` to `PATH`

* ci: don't run tests twice for PRs from forks

By only triggering on pushes to `master`, when users push to
non-`master` branches on forks, this workflow won't get triggered and
will only get triggered when users make a PR to the main repo.

* ci: update Nix to match versions in nixpkgs

---------

Co-authored-by: Francesc Esplugas <2720+fesplugas@users.noreply.github.com>
Co-authored-by: Michael Hoang <enzime@users.noreply.github.com>
Co-authored-by: Mike Moore <emmceemoore@gmail.com>
Co-authored-by: Emily <vcs@emily.moe>
Co-authored-by: will <will.bradshaw50@gmail.com>
Co-authored-by: Roger Steve Ruiz <hi@rog.gr>
Co-authored-by: isabel <isabel@isabelroses.com>
Co-authored-by: aspauldingcode <aspauldingcode@gmail.com>
Co-authored-by: Rohit Singh <rsrohitsingh682@gmail.com>
b4lisong added a commit to b4lisong/nix-config that referenced this issue Nov 17, 2024
b4lisong added a commit to b4lisong/nix-config that referenced this issue Nov 17, 2024
b4lisong added a commit to b4lisong/nix-config that referenced this issue Nov 17, 2024
simonrw added a commit to simonrw/nix-config that referenced this issue Nov 18, 2024
Specifically: using [this
advice](LnL7/nix-darwin#1082 (comment))
simonrw added a commit to simonrw/nix-config that referenced this issue Nov 18, 2024
Specifically: using [this
advice](LnL7/nix-darwin#1082 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants