nixconfig/generator.nix

62 lines
2.0 KiB
Nix
Raw Normal View History

2023-11-16 23:06:28 +01:00
{ inputs, ... }: {
generate = { type, system, host }:
2024-04-14 07:57:07 +02:00
let
nameValuePair = name: value: { inherit name value; };
syscfg = import ./systems/${host}/cfg.nix;
in ({
2023-11-16 23:06:28 +01:00
"nixos" = inputs.nixpkgs.lib.nixosSystem {
system = system;
modules = [
2024-04-14 07:57:07 +02:00
./modules/shared/syscfg
./modules/shared/sops
2023-11-16 23:06:28 +01:00
./modules/nixos
2024-04-14 07:57:07 +02:00
syscfg
2023-11-16 23:06:28 +01:00
./systems/${host}
2024-04-14 22:24:23 +02:00
inputs.sops-nix.nixosModules.sops
2023-11-16 23:06:28 +01:00
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
2024-04-14 07:57:07 +02:00
home-manager.users = builtins.listToAttrs (map (userConfig:
nameValuePair userConfig.username {
imports = [
./modules/shared/syscfg
./modules/shared/colors
./modules/home
syscfg
{ usercfg = userConfig; }
2024-04-14 22:24:23 +02:00
inputs.nix-colors.homeManagerModule
inputs.hyprland.homeManagerModules
2024-04-14 07:57:07 +02:00
];
}) syscfg.syscfg.users);
2023-11-16 23:06:28 +01:00
}
];
};
"macos" = inputs.darwin.lib.darwinSystem {
system = system;
modules = [
inputs.sops-nix.nixosModules.sops
./systems/${host}
inputs.home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.sora = {
imports = [
inputs.nix-colors.homeManagerModule
2024-04-14 22:24:23 +02:00
inputs.hyprland.homeManagerModules
2023-11-16 23:06:28 +01:00
./systems/${host}/home.nix
];
};
}
];
};
"home" = inputs.home-manager.lib.homeManagerConfiguration {
modules = [ ./modules/home ./systems/${host}/home.nix ];
};
_ = throw "Unsupported system";
}.${type});
}