some more updates

This commit is contained in:
John Lancaster
2025-06-30 15:17:24 -05:00
parent 338711c990
commit 8bc5d353c4

View File

@@ -17,27 +17,27 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib; lib = pkgs.lib;
# Define a module that contains the user option # Combined module that includes both options and configuration
optionsModule = { config, ... }: { combinedModule = { config, pkgs, ... }: {
options.user = lib.mkOption { options.user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "The username for the Home Manager configuration."; description = "The username for the Home Manager configuration.";
}; };
imports = [ ./home.nix ];
}; };
# Function to create a home configuration for any user # Function to create a home configuration for any user
mkHomeConfiguration = username: home-manager.lib.homeManagerConfiguration { mkHomeConfiguration = username: home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
./home.nix combinedModule
optionsModule
# Override the user option for this specific configuration # Override the user option for this specific configuration
{ user = username; } { user = username; }
]; ];
}; };
# Default username from the module evaluation # Default username from the module evaluation
evaluatedOptions = lib.evalModules { modules = [ optionsModule ]; }; evaluatedOptions = lib.evalModules { modules = [ combinedModule ]; };
userName = evaluatedOptions.config.user; userName = evaluatedOptions.config.user;
in in
{ {
@@ -50,10 +50,7 @@
}; };
# Export modules for reuse in other flakes # Export modules for reuse in other flakes
homeManagerModules = { homeManagerModules.default = combinedModule;
default = ./home.nix;
options-module = optionsModule;
};
# Export packages if you have any custom ones # Export packages if you have any custom ones
packages.${system} = { packages.${system} = {