Distributed build: Difference between revisions
m fix formatting + fix `-L` flag not working in `useradd` + add info to chown `~nixremote/.ssh` dir Tags: Mobile edit Mobile web edit |
m Changed `nix store ping` to `nix store info`, because of the warning: 'ping' is a deprecated alias for 'info'. |
||
| (5 intermediate revisions by 4 users not shown) | |||
| Line 40: | Line 40: | ||
{{Tip|The best test to check that the SSH access works for Nix is to run on your local machine: | {{Tip|The best test to check that the SSH access works for Nix is to run on your local machine: | ||
nix store | <code>nix store info --store ssh://<REMOTE-BUILDER></code> | ||
Where <REMOTE-BUILDER> is the remote builder's IP address, host address or whatever name you configure in ~/.ssh/config or /root/.ssh/config, including the user@ prefix.}} | Where <code><REMOTE-BUILDER></code> is the remote builder's IP address, host address or whatever name you configure in ~/.ssh/config or /root/.ssh/config, including the user@ prefix.}} | ||
An alternative check is: | An alternative check is: | ||
| Line 112: | Line 112: | ||
You may also want to make nix on '''the remote machine''' trust that new user by adding it to {{ic|nix.settings.trusted-users}} if it's using NixOS, or by manually adding <code><nowiki>trusted-users = nixremote</nowiki></code> to {{ic|/etc/nix/nix.conf}}. | You may also want to make nix on '''the remote machine''' trust that new user by adding it to {{ic|nix.settings.trusted-users}} if it's using NixOS, or by manually adding <code><nowiki>trusted-users = nixremote</nowiki></code> to {{ic|/etc/nix/nix.conf}}. | ||
== | == Modify the local machine's Nix config to know about the remote machine. == | ||
The Nix package manager '''on your local machine''' '''needs to know that the remote builder exists''' and what its ''supported features'' are. See [https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-system-features official supportedFeatures documentation]. | The Nix package manager '''on your local machine''' '''needs to know that the remote builder exists''' and what its ''supported features'' are. See [https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-system-features official supportedFeatures documentation]. | ||
| Line 153: | Line 153: | ||
nix.distributedBuilds = true; | nix.distributedBuilds = true; | ||
# optional, useful when the builder has a faster internet connection than yours | # optional, useful when the builder has a faster internet connection than yours | ||
nix. | nix.settings = { | ||
builders-use-substitutes = true | builders-use-substitutes = true; | ||
}; | |||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
| Line 249: | Line 249: | ||
* I can ping the store as root, but I'm getting "broken pipe" errors when trying to distribute. | * I can ping the store as root, but I'm getting "broken pipe" errors when trying to distribute. | ||
** You may have hit bug {{Issue|46038}}. Add <code>nix.distributedBuilds = true;</code> to <code>configuration.nix</code> and <code>nixos-rebuild switch</code>. | ** You may have hit bug {{Issue|46038}}. Add <code>nix.distributedBuilds = true;</code> to <code>configuration.nix</code> and <code>nixos-rebuild switch</code>. | ||
== Tips and tricks == | |||
=== One-time remote build === | |||
For a quick, one-time remote build without needing to change any system settings, see [[Nixos-rebuild#Deploying_on_other_machines]]. | |||
== See also == | == See also == | ||
* [https://github.com/NixOS/nix/blob/ | * [https://github.com/NixOS/nix/blob/a6e6da3b0c579fc540acb00748fe3fd1858b9d99/tests/nixos/remote-builds.nix#L11-L21 The NixOS Remote Builds Test Case] | ||
* [https://nixos.org/nix-dev/2015-September/018255.html Mail to nixos-dev about setting up remote builds by Russell O'Connor] | * [https://nixos.org/nix-dev/2015-September/018255.html Mail to nixos-dev about setting up remote builds by Russell O'Connor] | ||
* [https://gist.github.com/danbst/09c3f6cd235ae11ccd03215d4542f7e7 A step-by-step guide on remote Firefox building through bastion host] | * [https://gist.github.com/danbst/09c3f6cd235ae11ccd03215d4542f7e7 A step-by-step guide on remote Firefox building through bastion host] | ||