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