I try to migrate my nixops
from version 1.7 to nixops_unstable
2.0.0-pre-7220cbd. After installing nixops_unstable
I cannot work with the nixops
command anymore:
$ nixops deploy -d streaming
Traceback (most recent call last):
File "/nix/store/diamr11y34lkmnjwkyw5qnv5xcn1x60h-python3.9-nixops-2.0.0-pre-7220cbd/bin/.nixops-wrapped", line 9, in <module>
sys.exit(main())
File "/nix/store/3ybyi0v3pj8hlchzcchsx3m2myjpbmir-python3-3.9.13-env/lib/python3.9/site-packages/nixops/__main__.py", line 56, in main
args.op(args)
File "/nix/store/3ybyi0v3pj8hlchzcchsx3m2myjpbmir-python3-3.9.13-env/lib/python3.9/site-packages/nixops/script_defs.py", line 710, in op_deploy
with deployment(args, True, "nixops deploy") as depl:
File "/nix/store/gwlgfywzqypv91rxw916v81mpzhckdz5-python3-3.9.13/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/nix/store/3ybyi0v3pj8hlchzcchsx3m2myjpbmir-python3-3.9.13-env/lib/python3.9/site-packages/nixops/script_defs.py", line 72, in deployment
with network_state(args, writable, description=activityDescription) as sf:
File "/nix/store/gwlgfywzqypv91rxw916v81mpzhckdz5-python3-3.9.13/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/nix/store/3ybyi0v3pj8hlchzcchsx3m2myjpbmir-python3-3.9.13-env/lib/python3.9/site-packages/nixops/script_defs.py", line 102, in network_state
network = eval_network(get_network_file(args))
File "/nix/store/3ybyi0v3pj8hlchzcchsx3m2myjpbmir-python3-3.9.13-env/lib/python3.9/site-packages/nixops/script_defs.py", line 60, in get_network_file
raise ValueError(f"Neither flake.nix nor nixops.nix exists in {network_dir}")
ValueError: Neither flake.nix nor nixops.nix exists in /home/matthias/nixops
I guess the important part here is ValueError: Neither flake.nix nor nixops.nix exists in /home/matthias/nixops
. That’s correct, I never had nixops.nix
but this deployment is defined in /home/matthias/nixops/streaming.nix
.
For the moment I don’t want to migrate to using flakes, I just try to get the existing way working with nixops_unstable
.
Changing streaming.nix
to nixops.nix
does not work, probably because it cannot relate its existing state to this new file name, as the file is actually part of nixop’s state:
{
"c54b29a1-417e-11eb-9873-0242cc6606ab": {
"configsPath": "/nix/store/46s4g876yjdijfdjwpqqjzj94pyp05lz-nixops-machines",
"name": "streaming",
"nixExprs": "[\"/home/matthias/nixops/streaming.nix\"]",
"resources": {
"styx": {
"configsPath": "/nix/store/46s4g876yjdijfdjwpqqjzj94pyp05lz-nixops-machines",
"creationTime": "1608329862",
"index": "0",
"keys": "XXXXXXXX",
"none.sshPrivateKey": "XXXXXXXX\n",
"none.sshPublicKey": "XXXXXXXX",
"none.sshPublicKeyDeployed": "1",
"publicVpnKey": "XXXXXXXX",
"sshPinged": "1",
"state": "3",
"stateVersion": "20.09",
"targetHost": "styx.p7m.de",
"toplevel": "/nix/store/hjlv7mlp71rij4vn3dhvr6rxickldjaa-nixos-system-styx-22.05.915.9ff91ce2e4c",
"type": "none",
"vmId": "nixops-c54b29a1-417e-11eb-9873-0242cc6606ab-styx"
}
},
"rollbackEnabled": "1"
}
}
The documentation on migration I found is very sparse: https://nixops.readthedocs.io/en/latest/manual/migrating.html. More or less I could only find, that I have to define network.storage.legacy = {}
which does not solve my migration problem.
How do I change from <deployment>.nix
to nixops.nix
? How do I separate between different deployments, that I use to group similar servers?