105 lines
2.6 KiB
Nix
105 lines
2.6 KiB
Nix
![]() |
{
|
||
|
config,
|
||
|
lib,
|
||
|
pkgs,
|
||
|
...
|
||
|
}:
|
||
|
|
||
|
let
|
||
|
make_machine_config = name: {
|
||
|
enable = lib.mkOption {
|
||
|
type = lib.types.bool;
|
||
|
default = false;
|
||
|
example = true;
|
||
|
description = "Whether we want to use the ${name} machine during distributed builds.";
|
||
|
};
|
||
|
|
||
|
additional_config = lib.mkOption {
|
||
|
type = lib.types.attrs;
|
||
|
default = { };
|
||
|
example = lib.literalExpression {
|
||
|
speedFactor = 2;
|
||
|
};
|
||
|
description = "Additional config values for the buildMachines entry. For example, speedFactor.";
|
||
|
};
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
imports = [ ];
|
||
|
|
||
|
options.me = {
|
||
|
distributed_build.enable = lib.mkOption {
|
||
|
type = lib.types.bool;
|
||
|
default = false;
|
||
|
example = true;
|
||
|
description = "Whether we want to use multiple machines to perform a nixos-rebuild.";
|
||
|
};
|
||
|
|
||
|
distributed_build.machines.hydra = make_machine_config "hydra";
|
||
|
distributed_build.machines.quark = make_machine_config "quark";
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf config.me.distributed_build.enable (
|
||
|
lib.mkMerge [
|
||
|
{
|
||
|
nix.distributedBuilds = true;
|
||
|
}
|
||
|
(lib.mkIf config.me.distributed_build.machines.hydra.enable {
|
||
|
nix.buildMachines = [
|
||
|
(
|
||
|
{
|
||
|
hostName = "hydra";
|
||
|
sshUser = "nixworker";
|
||
|
# sshKey = "";
|
||
|
# publicHostKey = "";
|
||
|
systems = [
|
||
|
"x86_64-linux"
|
||
|
# "aarch64-linux"
|
||
|
];
|
||
|
maxJobs = 1;
|
||
|
supportedFeatures = [
|
||
|
# "nixos-test"
|
||
|
"benchmark"
|
||
|
"big-parallel"
|
||
|
# "kvm"
|
||
|
"gccarch-x86-64-v3"
|
||
|
"gccarch-x86-64-v4"
|
||
|
"gccarch-znver4"
|
||
|
];
|
||
|
}
|
||
|
// config.me.distributed_build.machines.hydra.additional_config
|
||
|
)
|
||
|
];
|
||
|
})
|
||
|
(lib.mkIf config.me.distributed_build.machines.quark.enable {
|
||
|
nix.buildMachines = [
|
||
|
(
|
||
|
{
|
||
|
hostName = "quark";
|
||
|
sshUser = "nixworker";
|
||
|
# sshKey = "";
|
||
|
# publicHostKey = "";
|
||
|
systems = [
|
||
|
"x86_64-linux"
|
||
|
# "aarch64-linux"
|
||
|
];
|
||
|
maxJobs = 1;
|
||
|
supportedFeatures = [
|
||
|
# "nixos-test"
|
||
|
"benchmark"
|
||
|
"big-parallel"
|
||
|
# "kvm"
|
||
|
"gccarch-x86-64-v3"
|
||
|
"gccarch-x86-64-v4"
|
||
|
"gccarch-znver4"
|
||
|
"gccarch-znver5"
|
||
|
];
|
||
|
}
|
||
|
// config.me.distributed_build.machines.quark.additional_config
|
||
|
)
|
||
|
];
|
||
|
})
|
||
|
]
|
||
|
);
|
||
|
}
|