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

User for specific systems #135

Open
Svenum opened this issue Oct 29, 2024 · 3 comments
Open

User for specific systems #135

Svenum opened this issue Oct 29, 2024 · 3 comments

Comments

@Svenum
Copy link

Svenum commented Oct 29, 2024

Is there a way to enable a user only for specific hosts (more then one)?
I have x systems in my config but want to enable only on two the home-manager config for an user.

I tried softlinks, but this does not work.

Is there any other way, than copying the whole user each time I change something?

@jakehamilton
Copy link
Member

Hmm, currently this is due to users defaulting to being enabled on systems with snowfallorg.users.<name>.create = true;. I've heard some people express a desire to have that (and .admin = true) default to false. This would be a breaking change so it won't happen unless we release a v4.

What you could do at the moment is disable the user on systems that you do not want it on. It's not ideal, but would get the job done.

{
  snowfallorg.users.myuser.create = false;
}

(You may also have to set snowfallorg.users.myuser.home.enable = false, if you do please file a bug report as this is not intended)

@delulumodule
Copy link

@jakehamilton Even if I set .create = false, I'm getting

error: The option `home-manager.users.alice.home.stateVersion' was accessed but has no value defined. Try setting the option.

when trying to deploy to a host that doesn't have this user. My homes/x86_64-linux/alice/default.nix doesn't define home.stateVersion because it differs per host, of course. Is there a way to work around this?

@delulumodule
Copy link

delulumodule commented Feb 16, 2025

Quick update, I've found this host config solves my problem.

snowfallorg.users.alice = {
  create = false;
  home.enable = false;
};

IMO having homes/x86_64-linux/alice without the @hostname part shouldn't auto-create the user on all hosts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants