Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux-builder additional options #878

Merged
merged 8 commits into from
Feb 23, 2024
75 changes: 71 additions & 4 deletions modules/nix/linux-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,95 @@ in
'';
};

mandatoryFeatures = mkOption {
type = types.listOf types.str;
default = [];
defaultText = literalExpression ''[]'';
example = literalExpression ''[ "big-parallel" ]'';
description = lib.mdDoc ''
A list of features mandatory for the Linux builder. The builder will
be ignored for derivations that don't require all features in
this list. All mandatory features are automatically included in
{var}`supportedFeatures`.

This sets the corresponding `nix.buildMachines.*.mandatoryFeatures` option.
'';
};

maxJobs = mkOption {
type = types.ints.positive;
default = 1;
example = 4;
description = lib.mdDoc ''
This option specifies the maximum number of jobs to run on the Linux builder at once.
The number of concurrent jobs the Linux builder machine supports. The
build machine will enforce its own limits, but this allows hydra
to schedule better since there is no work-stealing between build
machines.

This sets the corresponding `nix.buildMachines.*.maxJobs` option.
'';
};

protocol = mkOption {
type = types.str;
default = "ssh-ng";
defaultText = literalExpression ''"ssh-ng"'';
example = literalExpression ''"ssh"'';
description = lib.mdDoc ''
The protocol used for communicating with the build machine. Use
`ssh-ng` if your remote builder and your local Nix version support that
improved protocol.

Use `null` when trying to change the special localhost builder without a
protocol which is for example used by hydra.
'';
};

speedFactor = mkOption {
type = types.ints.positive;
default = 1;
defaultText = literalExpression ''1'';
description = lib.mdDoc ''
The relative speed of the Linux builder. This is an arbitrary integer
that indicates the speed of this builder, relative to other
builders. Higher is faster.

This sets the corresponding `nix.buildMachines.*.speedFactor` option.
'';
};

supportedFeatures = mkOption {
type = types.listOf types.str;
default = [ "kvm" "benchmark" "big-parallel" ];
defaultText = literalExpression ''[ "kvm" "benchmark" "big-parallel" ]'';
example = literalExpression ''[ "kvm" "big-parallel" ]'';
description = lib.mdDoc ''
This option specifies the list of features supported by the Linux builder.
A list of features supported by the Linux builder. The builder will
be ignored for derivations that require features not in this
list.

This sets the corresponding `nix.buildMachines.*.supportedFeatures` option.
'';
};

systems = mkOption {
type = types.listOf types.str;
default = [ "${stdenv.hostPlatform.uname.processor}-linux" ];
defaultText = literalExpression ''[ "''${stdenv.hostPlatform.uname.processor}-linux" ]'';
example = literalExpression ''
[
"x86_64-linux"
"aarch64-linux"
]
'';
description = lib.mdDoc ''
This option specifies system types the build machine can execute derivations on.

This sets the corresponding `nix.buildMachines.*.systems` option.
'';
};


workingDirectory = mkOption {
type = types.str;
default = "/var/lib/darwin-builder";
Expand Down Expand Up @@ -139,9 +207,8 @@ in
hostName = "linux-builder";
sshUser = "builder";
sshKey = "/etc/nix/builder_ed25519";
system = "${stdenv.hostPlatform.uname.processor}-linux";
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUpCV2N4Yi9CbGFxdDFhdU90RStGOFFVV3JVb3RpQzVxQkorVXVFV2RWQ2Igcm9vdEBuaXhvcwo=";
inherit (cfg) maxJobs supportedFeatures;
inherit (cfg) mandatoryFeatures maxJobs protocol speedFactor supportedFeatures systems;
}];

nix.settings.builders-use-substitutes = true;
Expand Down
Loading