diff --git a/flake.nix b/flake.nix index 7d22aeb..f6a66e2 100644 --- a/flake.nix +++ b/flake.nix @@ -15,8 +15,7 @@ system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; lib = pkgs.lib; - - # Defined up separately up here so that it can be evaluated by itself to determine the username + homeManagerModule = { config, pkgs, ... }: { options.user = lib.mkOption { type = lib.types.str; @@ -32,6 +31,12 @@ imports = [ ./home.nix ]; }; + # Function to create a home configuration for any user + mkHomeConfiguration = username: home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ homeManagerModule { user = username; } ]; + }; + # Default username from the module evaluation evaluatedOptions = lib.evalModules { modules = [ homeManagerModule ]; }; userName = evaluatedOptions.config.user; @@ -41,12 +46,7 @@ homeConfigurations.${userName} = mkHomeConfiguration userName; # Export the function so other flakes can create configurations for any user - lib.mkHomeConfiguration = username: home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - homeManagerModule { user = username; } - ]; - }; + lib.mkHomeConfiguration = mkHomeConfiguration; # Export modules for reuse in other flakes homeManagerModules.default = homeManagerModule; diff --git a/home.nix b/home.nix index 8d6dec0..05eacf5 100644 --- a/home.nix +++ b/home.nix @@ -81,5 +81,5 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; - programs.ssh.enable = true; + # programs.ssh.enable = true; }