diff --git a/modules/users/default.nix b/modules/users/default.nix index bc0f0c0..1d84a1d 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -19,55 +19,6 @@ in { ./ronja.nix ] ++ lib.optionals enableHomeManager [ - + ./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; - }; - }; - } - ]; - }; - }; } diff --git a/modules/users/home-manager.nix b/modules/users/home-manager.nix new file mode 100644 index 0000000..3166eb1 --- /dev/null +++ b/modules/users/home-manager.nix @@ -0,0 +1,65 @@ +{ + config, + pkgs, + lib, + ... +}: { + imports = [ + + ]; + + 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; + }; + }; + } + ]; + }; + }; +} diff --git a/modules/users/ronja.nix b/modules/users/ronja.nix index 8ca8311..7917792 100644 --- a/modules/users/ronja.nix +++ b/modules/users/ronja.nix @@ -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; + }; + }; } diff --git a/modules/users/vinzenz.nix b/modules/users/vinzenz.nix index 58cff2d..ac270a6 100644 --- a/modules/users/vinzenz.nix +++ b/modules/users/vinzenz.nix @@ -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; + }; + }; }