This commit is contained in:
soraefir
2024-04-17 00:25:54 +02:00
parent 6441652b8c
commit b644c87517
6 changed files with 172 additions and 151 deletions

View File

@ -1,43 +1,47 @@
{ inputs, ... }: {
generate = { type, system, host }:
generate = { syspath }:
let
syscfg = import ./systems/${syspath}/cfg.nix;
nameValuePair = name: value: { inherit name value; };
syscfg = import ./systems/${host}/cfg.nix;
in ({
"nixos" = inputs.nixpkgs.lib.nixosSystem {
system = system;
modules = [
./modules/shared/syscfg
./modules/shared/sops
./modules/nixos
syscfg
./systems/${host}
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users = builtins.listToAttrs (map (userConfig:
nameValuePair userConfig.username {
imports = [
./modules/shared/syscfg
./modules/shared/colors
./modules/home
syscfg
{ usercfg = userConfig; }
inputs.nix-colors.homeManagerModule
inputs.hyprland.homeManagerModules.default
];
}) syscfg.syscfg.users);
}
];
"nixos" = {
nisoxConfigurations."${syscfg.hostname}" =
inputs.nixpkgs.lib.nixosSystem {
system = syscfg.system;
modules = [
./modules/shared/syscfg
./modules/shared/sops
./modules/nixos
syscfg
syspath
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users = builtins.listToAttrs (map (userConfig:
nameValuePair userConfig.username {
imports = [
./modules/shared/syscfg
./modules/shared/colors
./modules/home
syscfg
{ usercfg = userConfig; }
inputs.nix-colors.homeManagerModule
inputs.hyprland.homeManagerModules.default
];
}) syscfg.syscfg.users);
}
];
};
};
"macos" = inputs.darwin.lib.darwinSystem {
system = system;
system = syscfg.system;
modules = [
inputs.sops-nix.nixosModules.sops
./systems/${host}
syspath
inputs.home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
@ -47,15 +51,15 @@
imports = [
inputs.nix-colors.homeManagerModule
inputs.hyprland.homeManagerModules
./systems/${host}/home.nix
./systems/${syspath}/home.nix
];
};
}
];
};
"home" = inputs.home-manager.lib.homeManagerConfiguration {
modules = [ ./modules/home ./systems/${host}/home.nix ];
modules = [ ./modules/home ./systems/${syscfg.hostname}/home.nix ];
};
_ = throw "Unsupported system";
}.${type});
}.${syscfg.type});
}