updates
This commit is contained in:
47
flake.nix
47
flake.nix
@@ -26,26 +26,43 @@
|
||||
};
|
||||
};
|
||||
|
||||
# Evaluate the module to get the config
|
||||
# Function to create a home configuration for any user
|
||||
mkHomeConfiguration = username: home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [
|
||||
./home.nix
|
||||
userModule
|
||||
# Override the user option for this specific configuration
|
||||
{ user = username; }
|
||||
];
|
||||
};
|
||||
|
||||
# Default username from the module evaluation
|
||||
moduleEval = lib.evalModules {
|
||||
modules = [ userModule ];
|
||||
};
|
||||
|
||||
username = moduleEval.config.user;
|
||||
defaultUsername = moduleEval.config.user;
|
||||
in
|
||||
{
|
||||
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
|
||||
# Specify your home configuration modules here, for example,
|
||||
# the path to your home.nix.
|
||||
modules = [
|
||||
./home.nix
|
||||
userModule # Include the user module in Home Manager modules too
|
||||
];
|
||||
|
||||
# Optionally use extraSpecialArgs
|
||||
# to pass through arguments to home.nix
|
||||
# Default configuration using the default username
|
||||
homeConfigurations.${defaultUsername} = mkHomeConfiguration defaultUsername;
|
||||
|
||||
# Export the function so other flakes can create configurations for any user
|
||||
lib = {
|
||||
mkHomeConfiguration = mkHomeConfiguration;
|
||||
mkHomeConfigurationForUser = username: mkHomeConfiguration username;
|
||||
};
|
||||
|
||||
# Export modules for reuse in other flakes
|
||||
homeManagerModules = {
|
||||
default = ./home.nix;
|
||||
john-config = ./home.nix;
|
||||
user-module = userModule;
|
||||
};
|
||||
|
||||
# Export packages if you have any custom ones
|
||||
packages.${system} = {
|
||||
# Add any custom packages here
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
4
home.nix
4
home.nix
@@ -3,8 +3,8 @@
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "john";
|
||||
home.homeDirectory = "/home/john";
|
||||
home.username = config.user;
|
||||
home.homeDirectory = "/home/${config.user}";
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
|
||||
Reference in New Issue
Block a user