-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow the same user profile to behave differently based on hostname #308
Comments
Related question: For the same username, can I configure it to have different user suites enabled on different hosts? For example I'd like to have GUI enabled for me on my laptop, but not on my server for the same username. |
Naively, it would be nice if we can set attrs in the hosts = {
laptop = { hostAttrs = { isServer = false; }; };
server = { hostAttrs = { isServer = true; }; };
}; And have |
Hi @yipengsun thank you for the use case! As a general design choice we want to have portable profiles as much as possible. We would even love to see them being portable across systems (nixos / darwin / hm). So in a sense, the intended control flow is from profiles → hosts. I think the right way might be to override (generic enough) profiles on a per host basis (e.g. in I hope this makes sense, please ask reply if not. We might need to have a more indepth conversation on the direction of the control flow, indeed.
Suites are nothing more than "profile aggregates" at their core, so you can define different combinations of profiles in suites and then
In recent Hope this all makes sense. I'm happy to continue this conversation, though. 😄 |
Hi, thanks for the quick reply! I think it make sense that system profiles (i.e. the profiles that only use NixOS modules, not I'm still confused about how to implement my original use case. After reading your reply, I think my questions become:
For the first question: Maybe it's better if I provide a concrete example. Currently, in the { ... }:
{
home-manager.users.nixos = { suites, ... }: {
imports = suites.base;
};
users.users.nixos = {
uid = 1000;
password = "nixos";
description = "default";
isNormalUser = true;
extraGroups = [ "wheel" ];
};
} My understanding is that { suites, ... }:
{
### root password is empty by default ###
imports = suites.base;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.networkmanager.enable = true;
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
userOverride = {
nixos = {
home-manager.users.nixos = { suites, ... }: { imports = suites.someOtherUserSuite; };
};
};
} For the second question, I admit I haven't thought too much about the "control flow". If we want to maintain the ( Let's say we have {
# This is a home-manager profile
programs.awesome = {
wallpaper = <path_to_default_wallpaper>;
};
} How'd we override |
I suggest using In { lib, ... }: {
programs.gnupg.agent.pinentryFlavor = lib.mkDefault "curses";
} In { lib, ... }: {
programs.awesome.wallpaper = lib.mkDefault <path>;
} In { lib, ... }: {
home-manager.users.nixos = { suites, ... }: {
imports = lib.mkDefault suites.base;
};
} In { suites, ... }:
{
imports = suites.base;
programs.gnupg.agent.pinentryFlavor = "qt";
home-manager.users.nixos = { suites, ... }: {
imports = suites.someOtherUserSuite;
};
} |
You can define home-manager settings in different places. So your user profile can actually import the suite but in one host file you can do this:
Just like most other nixos options home-manager settings for one user defined in multiple places will get merged. |
I see! Thanks for the suggestions! |
If one does not want to have to be specific about the user at the host-level (e.g. with {
home-manager.sharedModules = [{ foo = "bar"; }];
} to have it apply to all users. |
Would your feature fix an existing issue?
Don't think so
Describe the solution you'd like
Currently system and user profiles seem to be completely separated. I'd like to have the ability to make user profile behave differently on different hosts.
For example, I use
awesome
window manager on all my Linux hosts, but I'd like to set different tiling layouts, color schemes, and wallpapers for different hosts (they have different screen resolution, per say).I think this will be solved if we can pass additional arguments to user profiles and/or suites.
Describe alternatives you've considered
Currently I can create different users for different hosts, e.g.
user1-host1
,user1-host2
but I think this is not very elegant.The text was updated successfully, but these errors were encountered: