stripped down
This commit is contained in:
27
flake.nix
27
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;
|
||||
};
|
||||
}
|
||||
|
||||
9
git-personal.nix
Normal file
9
git-personal.nix
Normal file
@@ -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";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user