Centralize the config for buildMachines.
This commit is contained in:
parent
4a303d17d8
commit
98f98a8895
@ -16,6 +16,7 @@
|
|||||||
./roles/boot
|
./roles/boot
|
||||||
./roles/chromecast
|
./roles/chromecast
|
||||||
./roles/chromium
|
./roles/chromium
|
||||||
|
./roles/distributed_build
|
||||||
./roles/docker
|
./roles/docker
|
||||||
./roles/ecc
|
./roles/ecc
|
||||||
./roles/emacs
|
./roles/emacs
|
||||||
|
@ -9,48 +9,19 @@
|
|||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
nix.distributedBuilds = true;
|
me.distributed_build.enable = true;
|
||||||
nix.buildMachines = [
|
me.distributed_build.machines.hydra = {
|
||||||
{
|
enable = true;
|
||||||
hostName = "hydra";
|
additional_config = {
|
||||||
sshUser = "nixworker";
|
|
||||||
systems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
# "aarch64-linux"
|
|
||||||
];
|
|
||||||
maxJobs = 1;
|
|
||||||
speedFactor = 2;
|
speedFactor = 2;
|
||||||
supportedFeatures = [
|
};
|
||||||
# "nixos-test"
|
};
|
||||||
"benchmark"
|
me.distributed_build.machines.quark = {
|
||||||
"big-parallel"
|
enable = true;
|
||||||
# "kvm"
|
additional_config = {
|
||||||
"gccarch-x86-64-v3"
|
|
||||||
"gccarch-x86-64-v4"
|
|
||||||
"gccarch-znver4"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
hostName = "quark";
|
|
||||||
sshUser = "nixworker";
|
|
||||||
systems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
# "aarch64-linux"
|
|
||||||
];
|
|
||||||
maxJobs = 1;
|
|
||||||
speedFactor = 2;
|
speedFactor = 2;
|
||||||
supportedFeatures = [
|
};
|
||||||
# "nixos-test"
|
};
|
||||||
"benchmark"
|
|
||||||
"big-parallel"
|
|
||||||
# "kvm"
|
|
||||||
"gccarch-x86-64-v3"
|
|
||||||
"gccarch-x86-64-v4"
|
|
||||||
"gccarch-znver4"
|
|
||||||
"gccarch-znver5"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -9,28 +9,13 @@
|
|||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
nix.distributedBuilds = true;
|
me.distributed_build.enable = true;
|
||||||
nix.buildMachines = [
|
me.distributed_build.machines.hydra = {
|
||||||
{
|
enable = true;
|
||||||
hostName = "hydra";
|
additional_config = {
|
||||||
sshUser = "nixworker";
|
|
||||||
systems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
# "aarch64-linux"
|
|
||||||
];
|
|
||||||
maxJobs = 1;
|
|
||||||
speedFactor = 2;
|
speedFactor = 2;
|
||||||
supportedFeatures = [
|
};
|
||||||
# "nixos-test"
|
};
|
||||||
"benchmark"
|
|
||||||
"big-parallel"
|
|
||||||
# "kvm"
|
|
||||||
"gccarch-x86-64-v3"
|
|
||||||
"gccarch-x86-64-v4"
|
|
||||||
"gccarch-znver4"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
104
nix/configuration/roles/distributed_build/default.nix
Normal file
104
nix/configuration/roles/distributed_build/default.nix
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
{
|
||||||
|
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
|
||||||
|
)
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user