Colmena | 326 Members | |
| A simple, stateless NixOS deployment tool - https://github.com/zhaofengli/colmena | 111 Servers |
| Sender | Message | Time |
|---|---|---|
| 5 Apr 2022 | ||
| Hi. Thinking about moving my legacy nixops config over to colmena+flakes. I know colmena doesn't create machines on the fly, which is fine since I'm running my setup on bare metal. But I like testing on VMs first when I make big changes. How does one go about testing against a staging environment in colmena? Import that same config into two different host entries? | 23:49:02 | |
In reply to @jhillyerd:matrix.orgYou could use a shim like this: https://github.com/zhaofengli/colmena/issues/60#issuecomment-1047199551 and stay consistent with the de-facto flake output standard. Then, you could use the resulting derivation at self.nixosConfigurations.<name>.config.system.build.vm to run the VM as it was possible with nixos-rebuild build-vm | 23:53:12 | |
| 6 Apr 2022 | ||
| So if I'm reading that right, you are configuring your system using the nix flake nixosConfigurations syntax, then mapping it into the colmena attribute? | 00:00:40 | |
| Exactly | 00:00:53 | |
| I guess that leaves the other half of my question, applying the same config to two different machines... I suppose I could just use nixos-rebuild with the flake and --target-host pointing at my test vm? | 00:02:52 | |
| Something like this in your flake should give you the VMs as a
| 00:03:19 | |
| I'm doing something similar, by cross-compiling SD-Images for my aarch64 hosts | 00:03:39 | |
| (But there I'm filtering to check whether the sdImage build output exists) | 00:04:55 | |
Oh nice. That would leave me with a script similar to nixos-rebuild build-vm ? | 00:11:38 | |
| exactly | 00:11:43 | |
Note that you don't need these packages - you can access that attribute directly like this: nix build .\#nixosConfigurations.<hostname>.config.system.build.vm | 00:14:17 | |
| Result looks like this:
| 00:15:03 | |
(and the run-cottonbox-vm script spawns the qemu instance) | 00:15:33 | |
| Cool. So it sounds like step 1 for me is to move my existing nixops into a flake, get the test vm running, then I can look at mapping the flake into colmena. | 00:22:51 | |
| Yes, that's a plan | 00:23:55 | |
| jhillyerd: although I'm heading to bed now, feel free to ping me. I did exactly the same migration from nixops to colmena+flakes | 00:40:19 | |
| 05:00:56 | ||
| 7 Apr 2022 | ||
| 08:17:39 | ||
| 8 Apr 2022 | ||
Sooo, building on the VM question: Did someone happen to stumble across a method of testing the whole deployment at once in VMs? Otherwise, I'll see whether I can build on the config.system.build.vm derivation and create a script that runs them in the same network | 15:13:14 | |
| Not a real answer, but maybe you can take a look at the e2e tests that I have: https://github.com/zhaofengli/colmena/tree/main/integration-tests/apply | 18:10:53 | |
| But yeah, I kind of want a nice setup to do something like that as well | 18:11:15 | |
In reply to @zhaofeng:zhaofeng.liI think it would generally be nice to have some place to collect useful snippets like the one I've posted in https://github.com/zhaofengli/colmena/issues/60 | 23:11:56 | |
| 10 Apr 2022 | ||
| I finished porting my old nixops config to a standard (not colmena) flake. Next I need to figure out secrets, as the janky system I was using previously doesn't work with flakes. Does the colmena secret deployment system work with the pure build environment of flakes? | 00:23:40 | |
If you use the config.system.build.vm-path for the flakes, then there is no implementation for "uploading" the keys. I did not look into doing that myself, but might need to do soon | 00:30:33 | |
* If you use e.g. the config.system.build.vm-path for the flakes, then there is no implementation for "uploading" the keys. I did not look into doing that myself, but might need to do soon | 00:30:44 | |
So keys are only uploaded if you're using colmena, but not with the built flakes | 00:31:00 | |
| https://github.com/zhaofengli/colmena/pull/73 i wanted to quickly ping, to see if this is mergeable stuff. I think it's a neat ides to spin this further so that projecta can declare their local evaluator (which is great for lowering the magic) while still using upstream options and modules. | 00:37:14 | |
| I think the next improvement to this PR would be to make the evaluator configurable, so that it doesn't need to be patched into the binary. | 00:38:12 | |
| That way people can modify the colmena interface at will and make it work for their code / project structure. | 00:38:52 | |
| Instead of doing complicated transforms to match the expected interface. | 00:39:24 | |