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

Installation issues: services.nix-daemon and nix.nixPath #105

Open
grossbart opened this issue Sep 30, 2018 · 6 comments
Open

Installation issues: services.nix-daemon and nix.nixPath #105

grossbart opened this issue Sep 30, 2018 · 6 comments

Comments

@grossbart
Copy link

I tried nix-darwin for the first time and am very excited how it let's me use Nix even more. During installation I encountered two problems.

Edit config: Nix daemon

The installer asked whether I would want to edit the default config – of course I had to have a look! I enabled services.nix-daemon.enable = true; and services.nix-daemon.enableSocketListener = true; because I was excited to get an auto-upgrading Nix.

The problem with that was that the install then failed because the proper users that the launch daemon requires were not setup yet. I was then uncertain whether this broke something important and removed Nix and nix-darwin completely and redid the install.

Is it indeed a problem when the install aborts like this or could I have just continued? If it is a problem, would it make sense to make a change to the installer to work around this issue?

Warnings for root channels

After the install I got warnings that /nix/var/nix/profiles/per-user/root/channels did not exist, which was true. I'm not sure what this is used for; is it for multi-user installs? I'm using Nix 2.1.2 with the single-user install.

I fixed it by setting the path like so:

nix.nixPath =
    [ "darwin-config=$HOME/.nixpkgs/darwin-configuration.nix"
      "darwin=$HOME/.nix-defexpr/channels/darwin"
      "$HOME/.nix-defexpr/channels"
    ];

Should this be the default instead of https://github.com/LnL7/nix-darwin/blob/master/modules/nix/default.nix#L318 now that Nix has changed back to default to single-user installs?

@LnL7
Copy link
Owner

LnL7 commented Oct 1, 2018

Was the error message this?

error: Using the nix-daemon requires build users, aborting activation
Create the build users or disable the daemon:
$ ./bootstrap -u

or set

    services.nix-daemon.enable = false;

This is one of the checks put into place to avoid problems that are hard to recover from, at this point nothing should have happened yet. You can just edit the configuration and rebuild again if that's the case.

As for channels, that's a good point. It's probably best to extend NIX_PATH dynamically, like we do now on nixos.

@grossbart
Copy link
Author

Yes, the error message was indeed the nix-daemon requires build users one. I was a bit overwhelmed with the recommendation to create them myself, as I had no idea what users to create and where to start.

If I can just restart all is fine, it's also what I did. But then I got the error with the NIX_PATH and wasn't sure whether that was due to the missing build users or the aborted install …

So it seems that technically all is well and that it was just an unfortunate combination of errors that was confusing, thanks for your help!

@LnL7
Copy link
Owner

LnL7 commented Oct 2, 2018

Ah yes. You would have had to run the installer again if it didn't succeed the first time, that should work as expected with an existing configuration.

@ericpashman
Copy link

I get this warning on running any darwin-* command:

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

In my case this warning isn't related to the daemon, but I'm posting here because I think it's another reason the default nix.nixPath should change per the OP's suggestion.

I get the warning simply because the default Nix installation script for a single-user installation does not create a user profile for root, so the path doesn't exist. It seems clear that the nix-darwin installer should only add this path to the default nix.nixPath after checking for a multi-user Nix installation (or that the path exists).

@ericpashman
Copy link

ericpashman commented Dec 20, 2019

FYI, to remove the root profile path from nix.nixPath, you must use mkForce because a change earlier this year made setting nix.nixPath merge rather than reset its entries. In your darwin-configuration.nix, add something like this:

  nix.nixPath = lib.mkForce [ "darwin-config=/configuration.nix" ... ];

As far as I can tell, this behavior is documented only in the CHANGELOG.

But while this does reset nix.nixPath, it does not change my NIX_PATH at all! Does anybody know what's going on here?

EDIT: Doing something like source ${config.system.build.setEnvironment} in my shellInit does update NIX_PATH, but surely I'm not meant to have to do that?

@rerb
Copy link

rerb commented Jul 27, 2020

Note, any other miserable castaways and flotsam-dodgers on the choppy seas of nix-on-macos, you're gonna need to insert lib into the curly-brace-demarcated, comma-separated list at the beginning of your darwin-configuration.nix, if it ain't already there.

hurricanehrndz added a commit to hurricanehrndz/nixcfg that referenced this issue Apr 2, 2023
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

4 participants