bug: Error switching to initial config using flakes on MacOs
sdedovic opened this issue · comments
Stevan Dedovic commented
Are you following the right branch?
- My Nixpkgs and Home Manager versions are in sync
Is there an existing issue for this?
- I have searched the existing issues
Issue description
If I run nix run home-manager/master -- switch --flake .
on MacOs Sonoma (14.0) I see the following error:
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLaunchAgents
Activating checkLinkTargets
Activating writeBoundary
Activating copyFonts
Activating installPackages
installing 'home-manager-path'
error: opening lock file '/nix/var/nix/profiles/per-user/foobar/profile.lock': No such file or directory
Oops, Nix failed to install your new Home Manager profile!
Perhaps there is a conflict with a package that was installed using
"nix-env -i"? Try running
nix-env -q
and if there is a conflicting package you can remove it with
nix-env -e {package name}
Then try activating your Home Manager configuration again.
Please advise. This is on a clean nix install on my machine. I did not see any prerequisites on the Home Manager docs. Additionally, running nix run home-manager/master -- build --flake .
succeeds.
Maintainer CC
No response
System information
- system: `"x86_64-darwin"`
- host os: `Darwin 23.0.0, macOS 10.16`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.18.1`
- channels(root): `"nixpkgs"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
Stevan Dedovic commented
My abbreviated flake.nix
:
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
flake-utils,
nixpkgs,
home-manager,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
packages.homeConfigurations = {
foobar = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./modules/devtools.nix
({ pkgs, ... }: {
home.username = "foobar";
home.homeDirectory = if pkgs.stdenv.isDarwin then "/Users/foobar" else "/home/foobar";
home.stateVersion = "23.05"; # Please read the comment before changing.
home.devtools.enable = true;
})
];
};
};
});
}
Stevan Dedovic commented
I'm going to close this. I did a full Nix package manager uninstall and re-install, including destroying the nix store volume. Everything is working now.
I think the multi-user install on MacOS fixes the issue.