Reference: https://github.com/LnL7/nix-docker
# If on Darwin, I recommend keeping nix stuff contained
mkdir -p /nix/etc/nix
ln -s /nix/etc/nix /etc/nix # sysconfdir; can be overridden with $NIX_CONF_DIR
cd /nix/etc/nix/
openssl genrsa -out signing-key.sec 2048
openssl rsa -in signing-key.sec -pubout > signing-key.pub
chmod 600 signing-key.sec
ssh nix-docker mkdir -p /etc/nix
scp signing-key.sec <other-machine>:signing-key.sec
scp signing-key.pub <other-machine>:signing-key.pub
ssh <other-machine>
chmod 600 signing-key.*
mv signing-key.* /etc/nix
Set up a file remote-systems.conf
using this format: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/nix-daemon.nix#L343-L353
Then point $NIX_REMOTE_SYSTEMS
to that file.