better split of home manager specific stuff

This commit is contained in:
Vinzenz Schroeter 2023-09-24 13:12:09 +02:00
parent 9b60bc1988
commit 44bbfc2fa0
4 changed files with 87 additions and 81 deletions

View file

@ -19,55 +19,6 @@ in {
./ronja.nix
]
++ lib.optionals enableHomeManager [
<home-manager/nixos>
./home-manager.nix
];
config = lib.mkIf enableHomeManager {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
sharedModules = [
# set stateVersion
{home.stateVersion = "22.11";}
# make nano the default editor
{
home = {
sessionVariables.EDITOR = "nano";
file.".nanorc".text = lib.mkDefault ''
set linenumbers
set mouse
'';
};
}
# command line niceness
{
programs = {
command-not-found.enable = true;
dircolors.enable = true;
zsh = {
enable = true;
enableSyntaxHighlighting = true;
enableAutosuggestions = true;
enableVteIntegration = true;
};
};
}
# common git config
{
programs = {
git = {
enable = true;
extraConfig.init.defaultBranch = "main";
};
gh = {
enable = true;
enableGitCredentialHelper = true;
};
};
}
];
};
};
}

View file

@ -0,0 +1,65 @@
{
config,
pkgs,
lib,
...
}: {
imports = [
<home-manager/nixos>
];
config = {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users = {
ronja = lib.mkIf (builtins.elem "ronja" config.my.enabledUsers) (import ./ronja-home.nix);
vinzenz = lib.mkIf (builtins.elem "ronja" config.my.enabledUsers) (import ./vinzenz-home.nix);
};
sharedModules = [
# set stateVersion
{home.stateVersion = "22.11";}
# make nano the default editor
{
home = {
sessionVariables.EDITOR = "nano";
file.".nanorc".text = lib.mkDefault ''
set linenumbers
set mouse
'';
};
}
# command line niceness
{
programs = {
command-not-found.enable = true;
dircolors.enable = true;
zsh = {
enable = true;
enableSyntaxHighlighting = true;
enableAutosuggestions = true;
enableVteIntegration = true;
};
};
}
# common git config
{
programs = {
git = {
enable = true;
extraConfig.init.defaultBranch = "main";
};
gh = {
enable = true;
enableGitCredentialHelper = true;
};
};
}
];
};
};
}

View file

@ -6,20 +6,15 @@
}: let
isUserEnabled = builtins.elem "ronja" config.my.enabledUsers;
in {
config = lib.mkMerge [
(lib.mkIf isUserEnabled {
# Define user account
users.users.ronja = {
isNormalUser = true;
name = "ronja";
description = "Ronja Spiegelberg";
home = "/home/ronja";
extraGroups = ["networkmanager" "wheel" "games"];
shell = pkgs.zsh;
};
})
(lib.mkIf (isUserEnabled && config.my.modulesCfg.enableHomeManager) {
home-manager.users.ronja = import ./ronja-home.nix;
})
];
config = lib.mkIf isUserEnabled {
# Define user account
users.users.ronja = {
isNormalUser = true;
name = "ronja";
description = "Ronja Spiegelberg";
home = "/home/ronja";
extraGroups = ["networkmanager" "wheel" "games"];
shell = pkgs.zsh;
};
};
}

View file

@ -6,19 +6,14 @@
}: let
isUserEnabled = builtins.elem "vinzenz" config.my.enabledUsers;
in {
config = lib.mkMerge [
(lib.mkIf isUserEnabled {
users.users.vinzenz = {
isNormalUser = true;
name = "vinzenz";
description = "Vinzenz Schroeter";
home = "/home/vinzenz";
extraGroups = ["networkmanager" "wheel" "games"];
shell = pkgs.zsh;
};
})
(lib.mkIf (isUserEnabled && config.my.modulesCfg.enableHomeManager) {
home-manager.users.vinzenz = import ./vinzenz-home.nix;
})
];
config = lib.mkIf isUserEnabled {
users.users.vinzenz = {
isNormalUser = true;
name = "vinzenz";
description = "Vinzenz Schroeter";
home = "/home/vinzenz";
extraGroups = ["networkmanager" "wheel" "games"];
shell = pkgs.zsh;
};
};
}