-
Notifications
You must be signed in to change notification settings - Fork 407
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
Is nix-darwin installing a second Nix? #931
Comments
Yeah I also have this issue, I found this when I was trying to update the nix version. My nix doctor output:
Is this expected of nix-darwin? |
What probably happened is that you installed Nix itself, and then nix-darwin installed its own version of Nix. You can list your imperatively installed packages with |
@Samasaur1 We can't technically install nix-darwin without having nix so what would be a proper method of installation for flake nix-darwin |
I think this is just a situation where there's no better way to do it |
@Samasaur1 forgive me if I'm dumb but does this mean every single nix-darwin installation have such a problem of two nix installations? |
@thuvasooriya You'll have two Nix installations at some point. As far as I can tell, the best thing to do is
I kind of hate this, but I don't see a better way to do it. You need Nix to install nix-darwin, and nix-darwin should manage the systemwide version of Nix. And it just seems like a really bad idea to have the nix-darwin installer try to uninstall standalone Nix unprompted |
What kind of management does the nix-darwin do to the systemwide nix? |
@Samasaur1 How do you do step 3 - Uninstall standalone Nix. Also how do you upgrade nix (nix upgrade-nix does not work) |
@lucianthorr When I say nix-darwin "manages" the systemwide Nix, I mean that the Nix first on your PATH should come from nix-darwin. This means it's declaratively configured, pinned to a reproducible version, and all the other benefits that you get from installing software with nix-darwin over imperatively installing software. This is all-around a good thing, it just so happens that you need Nix to install nix-darwin in the first place. |
@bestlem see below
I don't have anything installed imperatively anymore, but if you post the output of both |
@bestlem oh also I forgot to answer your other question. Nix-Darwin defaults to the latest stable Nix, and you probably don't want to override this to a newer version. If you do, though, there's the |
@Samasaur1 Thanks for the reply. I kind of get the chicken and the egg problem here but I guess the nix-installer from the declarative systems is made in such a way to not allow nix uninstallation without removing nix-darwin first which would break a hell lot of stuff afaik. Check this out I think the readme file should be updated with regards to these issues and possible headaches associated with it. I guess an optional safe script to install nix and install nix-darwin and then uninstall the imperatively installed nix is a good choice to have since I haven't seem much devs playing with two nix versions at the same system. I'm just a beginner getting started with nix and I might be wrong. Please correct me. |
I am using flakes only. Sometimes doing a darwin-rebuild others just home-manager - from the same flake. The two nixes are one from Nix-Darwin and the other from the installer (in my case determinate systems) |
I have this same issue, but for some reason the default profile is taking precedence over the systemwide Nix package in my path - so I always end up only referencing the Determinate Systems-installed Nix version, which is older than I want to run :/ |
@remi-gelinas Which shell are you using? and what is your $PATH |
|
You can't uninstall the Determine Systems-installed Nix while using nix-darwin. However, it doesn't really cause issues (the nix-darwin nix is used instead), so I'd just leave it as is |
I don't know if this is related -> but I'm seeing the same stuff. Once I install Darwin I can no longer run |
I don't mind having two installations of nix when using nix-darwin, if both versions are somewhat recent. On my system nix-darwin uses What does it take to update the nix that nix-darwin uses? I'm curious and would appreciated if someone more knowledgable could provide some context on this. |
@afh Upgrade (and downgrade) can be done in your config files by setting option
or any of the nixVersions you can find in searching nixpkgs There are some regressions added by later version of nix so if your system is working then I would leave it. |
Thank you @bestlem, that's very helpful to know. I hear you lound and clear on leaving it, and I'll probably regret my decision to change the installed nix version, when things break, yet I'm keen on exploring the details of nix and nix-darwin more (including newer language features) and think there is benefit for me. |
You should almost definitely stay on Nix 2.18. Later versions are kind of just bug-filled messes, and so nixpkgs is staying on Nix 2.18 for a reason. |
@jeeftor what do you see when you try that? |
Thank you for chiming in, @Samasaur1. I was under the impression that the older nix was more a nix-darwin thing rather than nixpkgs. Thanks for clearing that up. From your experience what makes later versions of Nix kind of a bug filled mess? |
@afh I actually haven't used Nix > 2.18.x for specifically this reason. That said, I've seen lots of reports of Nix bugs in the Matrix rooms/other places, and they're fairly frequently caused by regressions. You can also look at the issues on NixOS/nix, some of which are labeled with "regression" |
@Samasaur1 on first glance 31 open regressions doesn't look to bad to me, but again I've only scratched Nix's surface, if even, so happy to trust the judgement of folks that are more involved. Out of curiosity: do you think an update of Nix in nixpkgs and nix-darwin will come with the next release, this year or even further out in the future? |
My issue was related to using determinate and not copying all the paths over... but previously only |
Glad you figured it out! |
I'm following the instructions here and it seems like I now have two versions of Nix installed.
Determinate Systems currently installed 2.20.5
Then after running
nix run nix-darwin -- switch --flake ~/.config/nix-darwin
, mynix --version
is 2.18.2.nix-doctor
also states that I have two conflicting nixes.Is that to be expected?
It's confusing (as a total newbie) also because I'm not sure what my PATH should be set to in .zshenv
export PATH="/nix/var/nix/profiles/default/bin:$PATH"
<-- Determinateexport PATH="/run/current-system/sw/bin:$PATH"
<--nix-darwinThe text was updated successfully, but these errors were encountered: