fix: add linuxModules/darwinModules in builder

This commit is contained in:
winston 2024-08-13 01:55:03 +02:00
parent 4b656a99b5
commit dfee46eef3
Signed by: winston
GPG key ID: 3786770EDBC2B481
2 changed files with 42 additions and 35 deletions

View file

@ -14,14 +14,12 @@
system = "aarch64-darwin"; system = "aarch64-darwin";
username = "winston"; username = "winston";
isGraphical = true; isGraphical = true;
extraModules = [ inputs.nekowinston-nur.darwinModules.default ];
} }
{ {
host = "futomaki"; host = "futomaki";
system = "x86_64-linux"; system = "x86_64-linux";
username = "winston"; username = "winston";
isGraphical = true; isGraphical = true;
extraModules = [ inputs.nixos-cosmic.nixosModules.default ];
} }
{ {
host = "yuba"; host = "yuba";

View file

@ -43,51 +43,60 @@ rec {
else else
throw "Unsupported system"; throw "Unsupported system";
target = ldTernary "nixosConfigurations" "darwinConfigurations"; target = ldTernary "nixosConfigurations" "darwinConfigurations";
builder = with inputs; ldTernary nixpkgs.lib.nixosSystem darwin.lib.darwinSystem; builder = ldTernary inputs.nixpkgs.lib.nixosSystem inputs.darwin.lib.darwinSystem;
module = ldTernary "nixosModules" "darwinModules"; module = ldTernary "nixosModules" "darwinModules";
hostPlatform = ldTernary "linux" "darwin"; hostPlatform = ldTernary "linux" "darwin";
linuxModules = [ inputs.nixos-cosmic.nixosModules.default ];
darwinModules = [ inputs.nekowinston-nur.darwinModules.default ];
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
inherit (pkgs.lib) mkOption types; inherit (pkgs.lib) mkOption types;
in in
{ {
${target}."${host}" = builder { ${target}."${host}" = builder {
inherit system; inherit system;
modules = [ modules =
{ [
options = { {
dotfiles = { options = {
username = mkOption { dotfiles = {
type = types.str; username = mkOption {
default = username; type = types.str;
description = "The username of the user"; default = username;
description = "The username of the user";
};
desktop = mkOption {
type = types.nullOr (
types.enum [
"cosmic"
"gnome"
"hyprland"
"sway"
]
);
default = if (pkgs.stdenv.isLinux && isGraphical) then "sway" else null;
description = "The desktop environment to use";
};
}; };
desktop = mkOption { isGraphical = mkOption {
type = types.nullOr ( type = types.bool;
types.enum [ default = isGraphical;
"cosmic" description = "Whether the system is a graphical target";
"gnome"
"hyprland"
"sway"
]
);
default = if (pkgs.stdenv.isLinux && isGraphical) then "sway" else null;
description = "The desktop environment to use";
}; };
}; };
isGraphical = mkOption { config.networking.hostName = host;
type = types.bool; }
default = isGraphical; ./common/shared
description = "Whether the system is a graphical target"; ./common/${hostPlatform}
}; ./${host}
}; inputs.home-manager.${module}.home-manager
config.networking.hostName = host; (hmCommonConfig { inherit username; })
} ]
./common/shared ++ lib.optionals pkgs.stdenv.isLinux linuxModules
./common/${hostPlatform} ++ lib.optionals pkgs.stdenv.isDarwin darwinModules
./${host} ++ extraModules;
inputs.home-manager.${module}.home-manager
] ++ [ (hmCommonConfig { inherit username; }) ] ++ extraModules;
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };