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 = [
../../../configs/home-manager/${name}
{
nixpkgs.overlays = config.overlays;
(
let
setupConfig = config;
in
{ config, lib, ... }: {
nixpkgs.overlays = setupConfig.overlays;
home.username = lib.mkForce name;
home.homeDirectory = lib.mkForce config.homeDirectory;
home.homeDirectory = lib.mkForce setupConfig.homeDirectory;
}
)
];
};
};

View File

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