nix-darwin
nix-darwin copied to clipboard
Installer fails with /etc/ file conflicts when running on a fresh Determinate Nix Installer install
I ran the nix-darwin flake installer, immediately after running the Determinate Nix installer. I got a couple of conflicts:
epetousis@evan-mba ~ % nix run nix-darwin -- switch --flake ~/.local/share/dotfiles
building the system configuration...
warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled
Password:
error: Unexpected files in /etc, aborting activation
The following files have unrecognized content and would be overwritten:
/etc/nix/nix.conf
/etc/zshenv
Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again.
I took a look and it's basically just a few defaults getting overwritten, plus Determinate Nix Installer's upgrade-nix-store-path-url
, which is probably not ideal to have nix-darwin overwrite. Is there meant to be support for this setup at the moment?
Here's the contents of both files with their SHA256 hashes (on request of @Enzime):
/etc/zshenv
# Set up Nix only on SSH connections
# See: https://github.com/DeterminateSystems/nix-installer/pull/714
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ] && [ -n "${SSH_CONNECTION}" ] && [ "${SHLVL}" -eq 1 ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
Checksum: d07015be6875f134976fce84c6c7a77b512079c1c5f9594dfa65c70b7968b65f /etc/zshenv.before-nix-darwin
/etc/nix/nix.conf
# See `/nix/nix-installer --version` for the version details.
build-users-group = nixbld
experimental-features = nix-command flakes repl-flake
bash-prompt-prefix = (nix:$name)\040
max-jobs = auto
extra-nix-path = nixpkgs=flake:nixpkgs
upgrade-nix-store-path-url = https://install.determinate.systems/nix-upgrade/stable/universal
Checksum: 5d23e6d7015756c6f300f8cd558ec4d9234ca61deefd4f2478e91a49760b0747 /etc/nix/nix.conf.before-nix-darwin
Is there anything special I need to do to use the new checksums?
I still get the error while running nix run nix-darwin -- switch --flake .
with my flake.nix
{
description = "Example Darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs }:
let
configuration = { pkgs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = (with pkgs; [
neovim
direnv
]);
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
# The platform the configuration will be used on.
nixpkgs = {
config.allowUnfree = true;
hostPlatform = "x86_64-darwin";
};
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#Macbook-Pro-13-Early-2015
darwinConfigurations."Macbook-Pro-13-Early-2015" = nix-darwin.lib.darwinSystem {
modules = [ configuration ];
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations."Macbook-Pro-13-Early-2015".pkgs;
};
}
I spent some time working thought the manual install...
First I get this error:
warning: unknown setting 'upgrade-nix-store-path-url'
I even made a blank /etc/nix.conf
and nothing seems to work there.
I wonder if its a permission issue or something... but very annoying I will say for sure.
I tried the manual install thinking I'd make some progress maybe:
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
nix-channel --update
export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels:$NIX_PATH
$(nix-build '<darwin>' -A system --no-out-link)/sw/bin/darwin-rebuild build
$(nix-build '<darwin>' -A system --no-out-link)/sw/bin/darwin-rebuild switch
However I think the issue is this:
Looks like Darwin expects a symlink into /etc/static/nix/nix.conf
I still get this error despite this being closed with #881. After uninstalling nix-darwin and then uninstalling nix which was installed from the official installer, then reinstalling Nix with the Determinate Installer and then nix-darwin with flakes. I'm not sure what to do next