Nixops deploy might fail if `nix.nixPath` fails to evaluate
Closed this issue · 4 comments
domenkozar commented
Error:
lugano-3> error: unable to download ‘http://nixos.org/releases/nixos/unstable-small/nixos-16.03pre77014.1c8a21d/nixexprs.tar.xz’: HTTP response code said error (22)
lugano-3> error: command ‘['ssh', '-oControlPath=/tmp/nixops-ssh-tmprvJpdV/master-socket', '-p', '22', '-o', 'StrictHostKeyChecking=no', '-i', '/tmp/nixops-tmpimoda7/id_nixops-lugano-3', '-p', '22', '-o', 'StrictHostKeyChecking=no', '-i', '/tmp/nixops-tmpimoda7/id_nixops-lugano-3', '-x', 'root@xxx', '--', 'NIX_REMOTE=daemon nix-env -p /nix/var/nix/profiles/system --set "/nix/store/1dfmjm2j6zpsm13l5ff815gqd3d9f0kj-nixos-system-lugano-3-16.03pre77568.40c586b"']’ failed on machine ‘lugano-3’ (exit code 1)
Workaround is to change line 645 in /nix/store/xka88770xkrb4xrfykc336jc2yc9sm81-nixops-1.3.1/lib/python2.7/site-packages/nixops/deployment.py to:
daemon_var = '' if m.state == m.RESCUE else 'NIX_PATH=nixpkgs=http://nixos.org/channels/nixos-unstable/nixexprs.tar.xz NIX_REMOTE=daemon '
rbvermaa commented
What does 'NIX_PATH fails to evaluate' mean exactly?
domenkozar commented
It's probably better to say nix.nixPath
domenkozar commented
I'm using the following patch to circumvent this:
diff --git a/nixops/deployment.py b/nixops/deployment.py
index a76184b..0a36934 100644
--- a/nixops/deployment.py
+++ b/nixops/deployment.py
@@ -665,7 +665,7 @@ class Deployment(object):
try:
# Set the system profile to the new configuration.
- daemon_var = '' if m.state == m.RESCUE else 'NIX_REMOTE=daemon '
+ daemon_var = '' if m.state == m.RESCUE else 'NIX_REMOTE=daemon NIX_PATH= '
setprof = daemon_var + 'nix-env -p /nix/var/nix/profiles/system --set "{0}"'
if always_activate or self.definitions[m.name].always_activate:
m.run_command(setprof.format(m.new_toplevel))
domenkozar commented
This will be fixed in new Nix release.