4

I'm trying to copy a Nix closure to my server, using

nix-copy-closure user@server.com /nix/store/somelonghash-programname

but I get

bash: nix-store: command not found
error: cannot connect to 'user@server.com'

When I login to the server with ssh user@server.com I can run nix-store --version and it works.

Both machines are running Ubuntu 16.04.

8n8
  • 171

1 Answers1

3

I found a workaround for this, from here. The script for making the Nix commands available is sourced in ~/.profile. I think the reason they are not available with nix-copy-closure that ssh doesn't source ~/.profile when commands are run non-interactively. Adding

command=". ~/.profile; if [ -n \"$SSH_ORIGINAL_COMMAND\" ]; then eval \"$SSH_ORIGINAL_COMMAND\"; else exec \"$SHELL\"; fi"

before my ssh public key (and on the same line) in ~/.ssh/authorized_keys on the server solves the problem for me.

I would still like to know why nix-copy-closure isn't handling this automatically.

8n8
  • 171