Closed TheKashe closed 9 months ago
Hi, curious if you had Nix installed previously or used the Determinate Systems Installer. The Determinate Systems Installer enables flakes and nix commands by default.
Nix experimental commands are enabled a few different ways:
/etc/nix/nix.conf
file. Mine has this line (from the Determinate Systems installer):experimental-features = nix-command flakes
nix --extra-experimental-features 'nix-command flakes' run .#apply
I used to include the extra long command as part of the README steps, but after moving to the Determinate Systems installer, I dropped it as I felt the verbosity was a little confusing for newcomers.
But curious how you installed Nix, as I may add it back.
FWIW, when I installed using using the Determinate Systems shell-based installer a few days ago, I didn't run into that problem for nix run .#apply
, but I did later on at step 9 when running nix run .#build
because I had deleted /etc/nix/nix.conf
as instructed in step 9. I also overcame this by manually adding the --extra-experimental-features 'nix-command flakes'
option to the command
Actually I just noticed all of this behavior is well-described in the Nix Flakes wiki. So maybe just add an obvious link to that in the README?
I think I used the macOS recommended way:
sh <(curl -L https://nixos.org/nix/install)
Adding
experimental-features = nix-command flakes
to nix.conf resolves it. It would be helpful to mention it in the readme. I guess the problem resurfaces once you rename the config.
Hey @TheKashe and @jspiers, thanks a ton. I've made a few changes to the README based on your report.
Added a section to help users enable Nix experimental commands that either had Nix installed or don't use the Determinate Systems installer
Removed the step to move nix.conf
out of the way based on this issue (looks like it's fixed now).
I'm having this issue as well (M3)
$ nixos-config % nix run .#build-switch
Running build-switch for aarch64-darwin
Starting build...
Switching to new generation...
building the system configuration...
error: Unexpected files in /etc, aborting activation
The following files have unrecognized content and would be overwritten:
/etc/nix/nix.conf
/etc/bashrc
Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again.
Should we move nix.conf
or something else?
Great project, BTW, Dustin, thanks!!
Hi @pfeodrippe,
Yes I will add a note to the README. This comes from nix-darwin and helps prevent files you have existing from being overwritten by the Nix config, without your consent.
You basically need to backup those files somewhere and remove them from their existing location . The nix config will replace them with copies from the configuration.
Note, my Nix config uses zsh
. So if you need to movebash
configuration over, you may want to switch the configuration to enable bash
. This is done in the shared home-manager file.
Hi @pfeodrippe,
Yes I will add a note to the README. This comes from nix-darwin and helps prevent files you have existing from being overwritten by the Nix config, without your consent.
You basically need to backup those files somewhere and remove them from their existing location . The nix config will replace them with copies from the configuration.
Note, my Nix config uses
zsh
. So if you need to movebash
configuration over, you may want to switch the configuration to enablebash
. This is done in the shared home-manager file.
Thank you, man \o Appreciate it
Hi,
I'm trying to install the config on nix 2.20.1. on macOS. nix run .#apply fails:
error: experimental Nix feature 'nix-command' is disabled; add '--extra-experimental-features nix-command' to enable it
This seems to work: