cleanup
This commit is contained in:
23
flake.nix
23
flake.nix
@@ -17,8 +17,8 @@
|
|||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
|
|
||||||
# Combined module that includes both options and configuration
|
# Define the module first (moved from below)
|
||||||
combinedModule = { config, pkgs, ... }: {
|
homeManagerModule = { 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.";
|
||||||
@@ -29,15 +29,11 @@
|
|||||||
# 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 = [ homeManagerModule { user = username; } ];
|
||||||
combinedModule
|
|
||||||
# Override the user option for this specific configuration
|
|
||||||
{ user = username; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Default username from the module evaluation
|
# Default username from the module evaluation
|
||||||
evaluatedOptions = lib.evalModules { modules = [ combinedModule ]; };
|
evaluatedOptions = lib.evalModules { modules = [ homeManagerModule ]; };
|
||||||
userName = evaluatedOptions.config.user;
|
userName = evaluatedOptions.config.user;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -45,16 +41,9 @@
|
|||||||
homeConfigurations.${userName} = mkHomeConfiguration userName;
|
homeConfigurations.${userName} = mkHomeConfiguration userName;
|
||||||
|
|
||||||
# Export the function so other flakes can create configurations for any user
|
# Export the function so other flakes can create configurations for any user
|
||||||
lib = {
|
lib = { mkHomeConfiguration = username: mkHomeConfiguration username; };
|
||||||
mkHomeConfiguration = username: mkHomeConfiguration username;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Export modules for reuse in other flakes
|
# Export modules for reuse in other flakes
|
||||||
homeManagerModules.default = combinedModule;
|
homeManagerModules.default = homeManagerModule;
|
||||||
|
|
||||||
# Export packages if you have any custom ones
|
|
||||||
packages.${system} = {
|
|
||||||
# Add any custom packages here
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user