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

Error: HOME is set to "/Users/xxx" but we expect "/var/empty" #4026

Closed
2 tasks done
sxyazi opened this issue May 27, 2023 · 6 comments
Closed
2 tasks done

Error: HOME is set to "/Users/xxx" but we expect "/var/empty" #4026

sxyazi opened this issue May 27, 2023 · 6 comments
Assignees
Labels

Comments

@sxyazi
Copy link

sxyazi commented May 27, 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

I encountered the error when I rebuilt after updating.

It's supposed to be caused by 6a19225. I'm on the Darwin system.

Maintainer CC

@rycee

System information

- system: `"aarch64-darwin"`
 - host os: `Darwin 22.5.0, macOS 13.4`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.13.3`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
@sxyazi sxyazi added bug triage Issues or feature request that have not been triaged yet labels May 27, 2023
@ncfavier
Copy link
Member

You should probably set your home directory to /Users/xxx in your nix-darwin configuration. I'm not sure how anything would work without it.

@ncfavier
Copy link
Member

Hmm, it seems like Home Manager's homeDirectory defaults to $HOME if the stateVersion is < 20.09. @rycee maybe we should skip the check in this situation?

@ncfavier ncfavier removed the triage Issues or feature request that have not been triaged yet label May 27, 2023
@sxyazi
Copy link
Author

sxyazi commented May 27, 2023

Wow, It works after setting users.users.xxx.home, thanks!
Not sure if it's a breaking change, my stateVersion is 23.05.

@rycee
Copy link
Member

rycee commented May 28, 2023

Ouch. I'm not sure what the correct way to use nix-darwin is in this case. It seems you are expected to explicitly set the home directory? There doesn't seem to be an isNormalUser option like in NixOS.

@LnL7 The default home directory of a user in nix-darwin seems to be set to /var/empty, which I would guess is not the right choice except for some system users. I assume that regular users are expected have an explicitly set users.users.<name>.home option?

We recently introduced a check in the Home Manager activation script that verifies that the user that the script is built for matches the user running the activation. This check led to this issue since @sxyazi had missed to set the home directory in the nix-darwin configuration.

The home directory option was originally introduced in LnL7/nix-darwin@b8713d5 and as far as I can tell it is mostly unchanged since then.

Perhaps nix-darwin could have something similar to NixOS's isSystemUser and isNormalUser flags to help user's get the right home directory configuration?

@sxyazi
Copy link
Author

sxyazi commented May 28, 2023

Thanks for the clear elaboration, so far it looks like setting users.users.xxx.home is the best way. I will wait a while to close the issue and see if anyone else also having the issue.

If so I will file an issue for nix-darwin and ask them to add the isSystemUser and isNormalUser flags, but this may not happen soon as nix-darwin is currently in a lack of maintenance situation.

thekorn added a commit to thekorn/nix-config that referenced this issue May 28, 2023
@sukhmel
Copy link

sukhmel commented May 28, 2023

@sxyazi I had the same problem after updating flakes just now. For now I used the users.users.xxx.home setting and it worked 🤷‍♂️

heywoodlh added a commit to heywoodlh/nixos-configs that referenced this issue May 30, 2023
Signed-off-by: Spencer Heywood <l.spencer.heywood@protonmail.com>
nichtsfrei added a commit to nichtsfrei/flakes that referenced this issue May 31, 2023
@sxyazi sxyazi closed this as completed Jun 6, 2023
lafrenierejm added a commit to lafrenierejm/dotfiles that referenced this issue Jun 11, 2023
zmre added a commit to zmre/nix-config that referenced this issue Jun 26, 2023
gtramontina added a commit to gtramontina/dotfiles that referenced this issue Aug 1, 2023
pcasaretto added a commit to pcasaretto/nix-home that referenced this issue Oct 24, 2023
evantravers added a commit to evantravers/dotfiles that referenced this issue Jan 31, 2024
Apparently there's some bug here that isn't solved:

Conversation about hotfix:
nix-community/home-manager#4026

Ticket about realfix:
LnL7/nix-darwin#682
stringang added a commit to stringang/dotfiles-darwin that referenced this issue Apr 24, 2024
stringang added a commit to stringang/dotfiles-darwin that referenced this issue Apr 24, 2024
stringang added a commit to stringang/dotfiles-darwin that referenced this issue Apr 24, 2024
stringang added a commit to stringang/dotfiles-darwin that referenced this issue Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants