diff --git a/flake.nix b/flake.nix index 82384c0..3d935dd 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,18 @@ extraGroups = lib.optionals config.root [ "wheel" ]; shell = lib.mkIf config.shell pkgs.zsh; }; + + homeManagerModules = config: [ + self.homeManagerModules.default { + user = config.user; + stateVersion = config.stateVersion; + profile = config.profile; + shell = config.shell; + ssh = config.ssh; + _1password = config._1password; + } + ] ++ config.extraImports; + in { homeManagerModules.default = { ... }: { @@ -67,24 +79,12 @@ extraSpecialArgs = { inherit inputs; }; users = { ${config.user} = { - imports = [ - self.homeManagerModules.default { - user = config.user; - stateVersion = config.stateVersion; - profile = config.profile; - shell = config.shell; - ssh = config.ssh; - _1password = config._1password; - } - ] ++ config.extraImports; + imports = homeManagerModules config; }; } // lib.optionalAttrs config.root { root = { - home.stateVersion = config.stateVersion; - imports = [ - ./nixosModules/options.nix - ./homeManagerModules/git.nix - ]; + # home.stateVersion = config.stateVersion; + imports = homeManagerModules (config // { user = "root"; }); }; }; }; diff --git a/home.nix b/home.nix index 0cd8922..875247b 100644 --- a/home.nix +++ b/home.nix @@ -10,7 +10,7 @@ # Home Manager needs a bit of information about you and the paths it should # manage. home.username = config.user; - home.homeDirectory = "/home/${config.user}"; + home.homeDirectory = lib.mkIf (config.user != "root") "/home/${config.user}"; home.stateVersion = config.stateVersion; # The home.packages option allows you to install Nix packages into your