NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.84k stars 363 forks source link

Create multiple networks from the same flake #1451

Open f4814 opened 3 years ago

f4814 commented 3 years ago

When creating a network from a flake, the network definition from outputs.nixopsConfigurations.default is used. However I think that using something like nixops create -d test --flake .#test, which would use the definition from output.nixopsConfigurations.test should be possible. Otherwise making a nixopsConfigurations attrset doesn't really make sense and is pretty counter-intuitive. (I had to check the code to find out here to find out, what the weird error I was getting meant).

roberth commented 3 years ago

I think maybe we should default -d to the attribute name as well, although storing multiple deployments in the same remote state is a bad idea because of locking.

JamesReynolds commented 2 years ago

I think I may be in a similar position: I've migrated from nixops 1.x where I had multiple deployments with different network definitions and I'm unable to replicate this in nixops 2.0. My current "solution" is to move my networks to separate folders and use nixops list --network=ec2 or nixops list --network=kvm etc...

It doesn't seem to be possible to make multiple network definitions in either nixops.nix or flakes.nix, unless I'm missing something.... which is quite possible!

(My use case is staging and testing environments using libvirtd locally and a proper deployment on ec2.)