flake-parts/setups: update Nix modules to be more self-contained

This commit is contained in:
Gabriel Arazas 2024-01-17 14:00:32 +08:00
parent b08945aa39
commit 8a9e20b5f4
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 36 additions and 17 deletions

View File

@ -158,11 +158,16 @@ let
modules = [ modules = [
../../../configs/home-manager/${name} ../../../configs/home-manager/${name}
{ (
nixpkgs.overlays = config.overlays; let
home.username = lib.mkForce name; setupConfig = config;
home.homeDirectory = lib.mkForce config.homeDirectory; in
} { config, lib, ... }: {
nixpkgs.overlays = setupConfig.overlays;
home.username = lib.mkForce name;
home.homeDirectory = lib.mkForce setupConfig.homeDirectory;
}
)
]; ];
}; };
}; };

View File

@ -209,14 +209,23 @@ let
inputs.${config.homeManagerBranch}.nixosModules.home-manager inputs.${config.homeManagerBranch}.nixosModules.home-manager
../../../configs/nixos/${name} ../../../configs/nixos/${name}
{ (
nixpkgs.overlays = config.overlays; let
networking.hostName = lib.mkDefault config.hostname; setupConfig = config;
} in
{ lib, ... }: {
config = lib.mkMerge [
{
nixpkgs.overlays = setupConfig.overlays;
networking.hostName = lib.mkDefault setupConfig.hostname;
}
(lib.mkIf (config.domain != null) { (lib.mkIf (config.domain != null) {
networking.domain = lib.mkForce config.domain; networking.domain = lib.mkForce setupConfig.domain;
}) })
];
}
)
]; ];
}; };
}; };
@ -289,11 +298,16 @@ in
config = lib.mkIf (cfg.configs != { }) { config = lib.mkIf (cfg.configs != { }) {
setups.nixos.sharedModules = [ setups.nixos.sharedModules = [
{ (
home-manager.useUserPackages = lib.mkDefault true; let
home-manager.useGlobalPkgs = lib.mkDefault true; osConfig = config;
home-manager.sharedModules = config.setups.home-manager.sharedModules; in
} { lib, ... }: {
home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.sharedModules = osConfig.setups.home-manager.sharedModules;
}
)
]; ];
flake = flake =