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";
username = "winston";
isGraphical = true;
extraModules = [ inputs.nekowinston-nur.darwinModules.default ];
}
{
host = "futomaki";
system = "x86_64-linux";
username = "winston";
isGraphical = true;
extraModules = [ inputs.nixos-cosmic.nixosModules.default ];
}
{
host = "yuba";

View file

@ -43,51 +43,60 @@ rec {
else
throw "Unsupported system";
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";
hostPlatform = ldTernary "linux" "darwin";
linuxModules = [ inputs.nixos-cosmic.nixosModules.default ];
darwinModules = [ inputs.nekowinston-nur.darwinModules.default ];
pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
inherit (pkgs.lib) mkOption types;
in
{
${target}."${host}" = builder {
inherit system;
modules = [
{
options = {
dotfiles = {
username = mkOption {
type = types.str;
default = username;
description = "The username of the user";
modules =
[
{
options = {
dotfiles = {
username = mkOption {
type = types.str;
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 {
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";
isGraphical = mkOption {
type = types.bool;
default = isGraphical;
description = "Whether the system is a graphical target";
};
};
isGraphical = mkOption {
type = types.bool;
default = isGraphical;
description = "Whether the system is a graphical target";
};
};
config.networking.hostName = host;
}
./common/shared
./common/${hostPlatform}
./${host}
inputs.home-manager.${module}.home-manager
] ++ [ (hmCommonConfig { inherit username; }) ] ++ extraModules;
config.networking.hostName = host;
}
./common/shared
./common/${hostPlatform}
./${host}
inputs.home-manager.${module}.home-manager
(hmCommonConfig { inherit username; })
]
++ lib.optionals pkgs.stdenv.isLinux linuxModules
++ lib.optionals pkgs.stdenv.isDarwin darwinModules
++ extraModules;
specialArgs = {
inherit inputs;
};