nixconfig/generator.nix

67 lines
2.2 KiB
Nix
Raw Normal View History

2023-11-16 23:06:28 +01:00
{ inputs, ... }: {
2024-04-17 08:26:08 +02:00
generate = { host }:
2024-04-14 07:57:07 +02:00
let
2024-04-17 08:26:08 +02:00
syscfg = import ./systems/${host}/cfg.nix;
2024-04-14 07:57:07 +02:00
nameValuePair = name: value: { inherit name value; };
in ({
2024-04-17 08:26:08 +02:00
"nixos" = inputs.nixpkgs.lib.nixosSystem {
system = syscfg.syscfg.system;
modules = [
./modules/shared/syscfg
./modules/shared/sops
./modules/nixos
syscfg
./systems/${host}
2024-04-20 12:58:28 +02:00
inputs.arion.nixosModules.arion
2024-04-17 08:26:08 +02:00
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);
}
];
2023-11-16 23:06:28 +01:00
};
2024-04-17 00:25:54 +02:00
2023-11-16 23:06:28 +01:00
"macos" = inputs.darwin.lib.darwinSystem {
2024-04-17 00:25:54 +02:00
system = syscfg.system;
2023-11-16 23:06:28 +01:00
modules = [
2024-04-17 08:26:08 +02:00
./modules/shared/syscfg
./modules/shared/sops
syscfg
./systems/${host}
2023-11-16 23:06:28 +01:00
inputs.sops-nix.nixosModules.sops
inputs.home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
2024-04-17 08:26:08 +02:00
home-manager.users = builtins.listToAttrs (map (userConfig:
nameValuePair userConfig.username {
imports = [
inputs.nix-colors.homeManagerModule
inputs.hyprland.homeManagerModules
];
}) syscfg.syscfg.users);
2023-11-16 23:06:28 +01:00
}
];
};
"home" = inputs.home-manager.lib.homeManagerConfiguration {
2024-04-17 08:26:08 +02:00
modules = [ ./modules/home ];
2023-11-16 23:06:28 +01:00
};
_ = throw "Unsupported system";
2024-04-17 08:26:08 +02:00
}.${syscfg.syscfg.type});
2023-11-16 23:06:28 +01:00
}