working again
This commit is contained in:
14
flake.nix
14
flake.nix
@@ -16,7 +16,6 @@
|
|||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
|
|
||||||
# Defined up separately up here so that it can be evaluated by itself to determine the username
|
|
||||||
homeManagerModule = { config, pkgs, ... }: {
|
homeManagerModule = { config, pkgs, ... }: {
|
||||||
options.user = lib.mkOption {
|
options.user = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -32,6 +31,12 @@
|
|||||||
imports = [ ./home.nix ];
|
imports = [ ./home.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
|
# Default username from the module evaluation
|
||||||
evaluatedOptions = lib.evalModules { modules = [ homeManagerModule ]; };
|
evaluatedOptions = lib.evalModules { modules = [ homeManagerModule ]; };
|
||||||
userName = evaluatedOptions.config.user;
|
userName = evaluatedOptions.config.user;
|
||||||
@@ -41,12 +46,7 @@
|
|||||||
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.mkHomeConfiguration = username: home-manager.lib.homeManagerConfiguration {
|
lib.mkHomeConfiguration = mkHomeConfiguration;
|
||||||
inherit pkgs;
|
|
||||||
modules = [
|
|
||||||
homeManagerModule { user = username; }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Export modules for reuse in other flakes
|
# Export modules for reuse in other flakes
|
||||||
homeManagerModules.default = homeManagerModule;
|
homeManagerModules.default = homeManagerModule;
|
||||||
|
|||||||
Reference in New Issue
Block a user