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

error: getting status of '/etc/nix/registry.json': Permission denied #1371

Open
bashfulrobot opened this issue Mar 6, 2025 · 2 comments
Open

Comments

@bashfulrobot
Copy link

Hi there, I am just having my first go with nix-darwin, and I was attempting to install with:

dustin.krysak@dustin nixcfg % curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
  sh -s -- install --determinate
info: downloading installer https://install.determinate.systems/nix/tag/v3.0.0/nix-installer-aarch64-darwin
 INFO nix-installer v3.0.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Password:
 INFO nix-installer v3.0.0
 INFO For a more robust Nix installation, use the Determinate package for macOS: https://dtr.mn/determinate-nix
Nix install plan (v3.0.0)
Planner: macos

Configured settings:
* determinate_nix: true

Planned actions:
* Install Determinate Nixd
* Create an encrypted APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
* Extract the bundled Nix (originally from /nix/store/cmirclrq3l1lnvm8psd1xrh5kiwabzx9-nix-binary-tarball-3.0.0/nix-3.0.0-aarch64-darwin.tar.xz) to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Synchronize /nix/var ownership
* Move the downloaded Nix into `/nix`
* Synchronize /nix/store ownership
* Create build users (UID 351-382) and group (GID 350)
* Configure Time Machine exclusions
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configuring zsh to support using Nix in non-interactive shells
* Unload, then recreate a `launchctl` plist to put Nix into your PATH
* Configure the Determinate Nix daemon
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Install Determinate Nixd
 INFO Step: Create an encrypted APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 351-382) and group (GID 350)
 INFO Step: Configure Time Machine exclusions
 INFO Step: Configure Nix
 INFO Step: Configuring zsh to support using Nix in non-interactive shells
 INFO Step: Unload, then recreate a `launchctl` plist to put Nix into your PATH
 INFO Step: Configure the Determinate Nix daemon
 INFO Step: Remove directory `/nix/temp-install-dir`
Nix was installed successfully!
To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`

dustin.krysak@dustin nixcfg % . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
dustin.krysak@dustin nixcfg % . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
dustin.krysak@dustin nixcfg % nix run nix-darwin/nix-darwin-24.11#darwin-rebuild -- switch
error: getting status of '/etc/nix/registry.json': Permission denied

But I keep getting this permission denied. And that file does not seem to exist.

dustin.krysak@dustin nixcfg % sudo ls /etc/nix
Password:
macos-keychain.crt	nix.conf		nix.custom.conf

Any ideas?

Cheers.

@ipetkov
Copy link

ipetkov commented Mar 16, 2025

To add some context from Mastodon: it seems like the installation instructions were written with flake registries in mind (I believe the official installer would set up a registry with a bunch of entries like nixpkgs pointing to github:NixOS/nixpkgs and nix-darwin pointing to github:LnL7/nix-darwin among others).

Flake registries (IMO) are kind of a confusing feature and I think the more modern DetSys/Lix installers don't set this up by default anymore which can result in the error above. I would consider changing the installation instructions to explicitly use github:LnL7/nix-darwin/... (instead of just nix-darwin) when referring to the flake to side step any such headaches

@bashfulrobot
Copy link
Author

@ipetkov - you beat me over here to add the details. 👍

I ended up using:

nix --extra-experimental-features flakes --extra-experimental-features nix-command run github:LnL7/nix-darwin/nix-darwin-24.11#darwin-rebuild -- switch --flake .#dustinkrysak

Note the github:LnL7.... - that's what I added. And now I am just getting what looks to be standard nix errors. 🤣

In the nix discourse there is also some debate as to if sudo is also needed, but the instructions do not say to use it, so I have not.

If you do, you get something like:

warning: $HOME ('/Users/username') is not owned by you, falling back to the one defined in the 'passwd' file ('/var/root')
building the system configuration...

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

No branches or pull requests

2 participants