You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- move all reference documentation to the `builders` configuration setting
- reword documentation on machine specification, add examples
- disable showing the default value, as it rendered as `@/dummy/machines`, which is wrong
- highlight the examples
Copy file name to clipboardexpand all lines: doc/manual/src/advanced-topics/distributed-builds.md
+8-92
Original file line number
Diff line number
Diff line change
@@ -36,16 +36,9 @@ error: cannot connect to 'mac'
36
36
then you need to ensure that the `PATH` of non-interactive login shells
37
37
contains Nix.
38
38
39
-
> **Warning**
40
-
>
41
-
> If you are building via the Nix daemon, it is the Nix daemon user account (that is, `root`) that should have SSH access to a user (not necessarily `root`) on the remote machine.
42
-
>
43
-
> If you can’t or don’t want to configure `root` to be able to access the remote machine, you can use a private Nix store instead by passing e.g. `--store ~/my-nix` when running a Nix command from the local machine.
44
-
45
-
The list of remote machines can be specified on the command line or in
46
-
the Nix configuration file. The former is convenient for testing. For
47
-
example, the following command allows you to build a derivation for
48
-
`x86_64-darwin` on a Linux machine:
39
+
The [list of remote machines](@docroot@/command-ref/conf-file.md#conf-builders) can be specified on the command line or in the Nix configuration file.
40
+
The former is convenient for testing.
41
+
For example, the following command allows you to build a derivation for `x86_64-darwin` on a Linux machine:
49
42
50
43
```console
51
44
$ uname
@@ -60,97 +53,20 @@ $ cat ./result
60
53
Darwin
61
54
```
62
55
63
-
It is possible to specify multiple builders separated by a semicolon or
64
-
a newline, e.g.
56
+
It is possible to specify multiple builders separated by a semicolon or a newline, e.g.
Copy file name to clipboardexpand all lines: src/libstore/globals.hh
+115-3
Original file line number
Diff line number
Diff line change
@@ -261,9 +261,121 @@ public:
261
261
Setting<std::string> builders{
262
262
this, "@" + nixConfDir + "/machines", "builders",
263
263
R"(
264
-
A semicolon-separated list of build machines.
265
-
For the exact format and examples, see [the manual chapter on remote builds](../advanced-topics/distributed-builds.md)
266
-
)"};
264
+
A semicolon- or newline-separated list of build machines.
265
+
266
+
In addition to the [usual ways of setting configuration options](@docroot@/command-ref/conf-file.md), the value can be read from a file by prefixing its absolute path with `@`.
267
+
268
+
> **Example**
269
+
>
270
+
> This is the default setting:
271
+
>
272
+
> ```
273
+
> builders = @/etc/nix/machines
274
+
> ```
275
+
276
+
Each machine specification consists of the following elements, separated by spaces.
277
+
Only the first element is required.
278
+
To leave a field at its default, set it to `-`.
279
+
280
+
1. The URI of the remote store in the format `ssh://[username@]hostname`.
281
+
282
+
> **Example**
283
+
>
284
+
> `ssh://nix@mac`
285
+
286
+
For backward compatibility, `ssh://` may be omitted.
287
+
The hostname may be an alias defined in `~/.ssh/config`.
288
+
289
+
2. A comma-separated list of [Nix system types](@docroot@/contributing/hacking.md#system-type).
290
+
If omitted, this defaults to the local platform type.
291
+
292
+
> **Example**
293
+
>
294
+
> `aarch64-darwin`
295
+
296
+
It is possible for a machine to support multiple platform types.
297
+
298
+
> **Example**
299
+
>
300
+
> `i686-linux,x86_64-linux`
301
+
302
+
3. The SSH identity file to be used to log in to the remote machine.
303
+
If omitted, SSH will use its regular identities.
304
+
305
+
> **Example**
306
+
>
307
+
> `/home/user/.ssh/id_mac`
308
+
309
+
4. The maximum number of builds that Nix will execute in parallel on the machine.
310
+
Typically this should be equal to the number of CPU cores.
311
+
312
+
5. The “speed factor”, indicating the relative speed of the machine as a positive integer.
313
+
If there are multiple machines of the right type, Nix will prefer the fastest, taking load into account.
314
+
315
+
6. A comma-separated list of supported [system features](#conf-system-features).
316
+
317
+
A machine will only be used to build a derivation if all the features in the derivation's [`requiredSystemFeatures`](@docroot@/language/advanced-attributes.html#adv-attr-requiredSystemFeatures) attribute are supported by that machine.
318
+
319
+
7. A comma-separated list of required [system features](#conf-system-features).
320
+
321
+
A machine will only be used to build a derivation if all of the machine’s required features appear in the derivation’s [`requiredSystemFeatures`](@docroot@/language/advanced-attributes.html#adv-attr-requiredSystemFeatures) attribute.
322
+
323
+
8. The (base64-encoded) public host key of the remote machine.
324
+
If omitted, SSH will use its regular `known_hosts` file.
325
+
326
+
The value for this field can be obtained via `base64 -w0`.
327
+
328
+
> **Example**
329
+
>
330
+
> Multiple builders specified on the command line:
> However, `poochie` will only build derivations that have the attribute
347
+
>
348
+
> ```nix
349
+
> requiredSystemFeatures = [ "benchmark" ];
350
+
> ```
351
+
>
352
+
> or
353
+
>
354
+
> ```nix
355
+
> requiredSystemFeatures = [ "benchmark" "kvm" ];
356
+
> ```
357
+
>
358
+
> `itchy` cannot do builds that require `kvm`, but `scratchy` does support such builds.
359
+
> For regular builds, `itchy` will be preferred over `scratchy` because it has a higher speed factor.
360
+
361
+
For Nix to use substituters, the calling user must be in the [`trusted-users`](#conf-trusted-users) list.
362
+
363
+
> **Note**
364
+
>
365
+
> A build machine must be accessible via SSH and have Nix installed.
366
+
> `nix` must be available in `$PATH` for the user connecting over SSH.
367
+
368
+
> **Warning**
369
+
>
370
+
> If you are building via the Nix daemon (default), the Nix daemon user account on the local machine (that is, `root`) requires access to a user account on the remote machine (not necessarily `root`).
371
+
>
372
+
> If you can’t or don’t want to configure `root` to be able to access the remote machine, set [`store`](#conf-store) to any [local store](store/types/local-store.html), e.g. by passing `--store /tmp` to the command on the local machine.
373
+
374
+
To build only on remote machines and disable local builds, set [`max-jobs`](#conf-max-jobs) to 0.
375
+
376
+
If you want the remote machines to use substituters, set [`builders-use-substitutes`](#conf-builders-use-substituters) to `true`.
0 commit comments