Distributed build: Difference between revisions

imported>Symphorien
Prerequisites: Replace StrictHostKeyChecking=no by StrictHostKeyChecking=accept-new in the tip
imported>Symphorien
Prerequisites: Explain how to have nix on PATH via ssh when the remote builder uses nix-user-chroot
Line 47: Line 47:
If you get an error like <code>serialised integer ... is too big for type j</code> this means that something (<code>/etc/profile</code> for example) outputs bytes to <code>stdout</code> before launching the command specified on the ssh
If you get an error like <code>serialised integer ... is too big for type j</code> this means that something (<code>/etc/profile</code> for example) outputs bytes to <code>stdout</code> before launching the command specified on the ssh
command line. Either disable this behavior or have the output be sent to <code>stderr</code> instead.
command line. Either disable this behavior or have the output be sent to <code>stderr</code> instead.
===== Non standard Nix installations =====
If you are not root on the remote builder and have used '''nix-user-chroot''' or '''PRoot''' to install nix there (see [[Nix Installation Guide]]) then nix is not available on the PATH of the remote builder. We describe a solution for nix-user-chroot which is easily adapted to PRoot.
* Create a script <code>~/bin/nix_wrapper.sh</code> as follows:
<syntaxHighlight lang="sh">
#!/bin/sh
exec ~/bin/nix-user-chroot ~/.nix bash -c '
. ~/.nix-profile/etc/profile.d/nix.sh
exec $SSH_ORIGINAL_COMMAND
'
</syntaxHighlight>
Of course, adapt this script to the location of the store and nix-user-chroot. Make the script executable.
* In <code>~/.ssh/authorized_keys</code>, locate the line corresponding to <code>~/.ssh/nix_remote.pub</code> and prepend this: <code>command="/home/something/bin/nix_wrapper.sh"</code>.
Now ssh will transparently run nix-user-chroot when you connect to the remote builder with the specified ssh key.


== Single user install ==
== Single user install ==