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

bug: Error switching to initial config using flakes on MacOs #4611

Closed
2 tasks done
sdedovic opened this issue Oct 28, 2023 · 5 comments
Closed
2 tasks done

bug: Error switching to initial config using flakes on MacOs #4611

sdedovic opened this issue Oct 28, 2023 · 5 comments
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@sdedovic
Copy link

sdedovic commented Oct 28, 2023

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`
@sdedovic sdedovic added bug triage Issues or feature request that have not been triaged yet labels Oct 28, 2023
@sdedovic
Copy link
Author

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;
            })
          ];
        };
      };
    });
}

srid added a commit to juspay/nixos-unified-template that referenced this issue Jan 2, 2024
@sdedovic
Copy link
Author

sdedovic commented Jan 4, 2024

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.

@sdedovic sdedovic closed this as completed Jan 4, 2024
@brizzbuzz
Copy link

hmm i'm running into this too… curious if anyone has a better solution than a full reinstall

@sdedovic
Copy link
Author

sdedovic commented Feb 3, 2024

hmm i'm running into this too… curious if anyone has a better solution than a full reinstall

I think if you look at the other issue referenced above here
they documented the following:

# Run 
sudo mkdir /nix/var/nix/profiles/per-user/$USER/
sudo chown $USER /nix/var/nix/profiles/per-user/$USER 

though I have not tried this as I found it easier to burn everything down and try again 😄

@srid
Copy link

srid commented Mar 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

No branches or pull requests

6 participants