nixconfig/generator.nix
soraefir 52423ffdad
Some checks failed
Nix Build / build-nixos (push) Failing after 22s
more WM
2024-04-14 22:24:23 +02:00

62 lines
2.0 KiB
Nix
Executable File

{ inputs, ... }: {
generate = { type, system, host }:
let
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
];
}) syscfg.syscfg.users);
}
];
};
"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
inputs.hyprland.homeManagerModules
./systems/${host}/home.nix
];
};
}
];
};
"home" = inputs.home-manager.lib.homeManagerConfiguration {
modules = [ ./modules/home ./systems/${host}/home.nix ];
};
_ = throw "Unsupported system";
}.${type});
}