Distributed build: Difference between revisions
Malteneuss (talk | contribs) Fix typo |
Malteneuss (talk | contribs) m Make ssh access table more beginner friendly |
||
| Line 9: | Line 9: | ||
The main tool to connect to a remote builder, exchange files and trigger builds is SSH. | The main tool to connect to a remote builder, exchange files and trigger builds is SSH. | ||
Depending on how you installed the [https://nixos.org/download/ Nix package manager], | |||
* '''"multi-user"''' (system-wide installation; default on NixOS, normal case for most private Linux distro users) or | |||
* '''"single-user"''' (installed only for a single user on the machine; used when no root/admin rights were available for the user), | |||
on your local and remote machine you need to allow a certain local SSH user (on your local machine) to connect to a certain remote SSH user (on the remote machine): | |||
{| class="wikitable" style="margin:auto" | {| class="wikitable" style="margin:auto" | ||
|- | |- | ||
! Local Machine ! | ! Nix Installation | ||
Local Machine | |||
! Nix Installation | |||
Remote Builder | |||
! SSH Connection Requirements | |||
|- | |- | ||
| | | '''Multi-user''' || '''Multi-user''' || '''Local''' machine's {{ic|root}} user needs SSH access to ''a'' user on the '''remote''' machine. '''(most frequent case)''' | ||
|- | |- | ||
| Single-user | | Single-user || Multi-user || ''Your'' user on your '''Local''' machine needs SSH access to ''a'' user on the '''remote''' machine. | ||
|- | |- | ||
| | | Multi-user || Single-user || '''Local''' machine's {{ic|root}} user needs SSH access to the user on the '''remote''' machine, with Nix installed with their UID (see [https://nixos.org/manual/nix/stable/installation/single-user.html Nix manual page]). | ||
|- | |- | ||
| Single-user | | Single-user || Multi-user || ''Your'' user on your '''Local''' machine needs SSH access to the user on the '''remote''' machine, with Nix installed with their UID (see [https://nixos.org/manual/nix/stable/installation/single-user.html Nix manual page]). | ||
|} | |} | ||
In any case, the | The thing to know about the '''"Multi-user"''' installation is that '''Nix is installed with a "nix-daemon" background process that runs as root''' and actually manages the builds on your behalf. So when your non-root user calls '''"nix build ...", this is delegated to the nix-daemon''' process, which runs as root. And this process can further delegate the build to a remote builder; that's why the '''local machine's root user''' needs the SSH access. | ||
In any case, the good test for Nix SSH access, that takes this into account, is: | |||
{{Commands|nix store ping --store ssh://<REMOTE-BUILDER>}} | {{Commands|nix store ping --store ssh://<REMOTE-BUILDER>}} | ||