diff --git a/flake.nix b/flake.nix index f6a66e2..1214290 100644 --- a/flake.nix +++ b/flake.nix @@ -15,8 +15,9 @@ system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; lib = pkgs.lib; - - homeManagerModule = { config, pkgs, ... }: { + in + { + homeManagerModules.default = { config, pkgs, ... }: { options.user = lib.mkOption { type = lib.types.str; description = "The username for the Home Manager configuration."; @@ -28,27 +29,7 @@ description = "Profile type for the Home Manager configuration."; }; - imports = [ ./home.nix ]; + imports = [ ./home.nix ] ++ lib.optionals (config.profile == "personal") [ ./git-personal.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; - in - { - # Default configuration using the default username - homeConfigurations.${userName} = mkHomeConfiguration userName; - - # Export the function so other flakes can create configurations for any user - lib.mkHomeConfiguration = mkHomeConfiguration; - - # Export modules for reuse in other flakes - homeManagerModules.default = homeManagerModule; }; } diff --git a/git-personal.nix b/git-personal.nix new file mode 100644 index 0000000..d30ba88 --- /dev/null +++ b/git-personal.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + programs.git = { + enable = true; + extraConfig.credential.helper = "store --file ~/.git-credentials"; + userName = "John Lancaster"; + userEmail = "32917998+jsl12@users.noreply.github.com"; + }; +} \ No newline at end of file