4 ms·
Has anyone explored CD tooling with Nix? And I don't mean the deployment of NixOS machines themselves (NixOps, deploy-rs, etc), I mean actually using Nix for de
by madjam002 6y ago
Has anyone explored CD tooling with Nix? And I don't mean the deployment of NixOS machines themselves (NixOps, deploy-rs, etc), I mean actually using Nix for deployment tooling and orchestrating deployments using the Nix language.
I am yet to find any posts about this or any tools, but have had great success with a small hand rolled tool that essentially lets me decoratively describe cloud resources, parts of my application, deployment "end state", and run the tools required to materialise that (Terraform, nixos-rebuild, etc) similar to GitHub Actions. Hydra is distributed CI for nix-build but does not handle CD or is designed to handle jobs with side effects AFAIK.
NixOS is great, but for me this is even more valuable, as I now have an introspect-able view of my entire deployed real estate, and can essentially `nix run ...` to deploy any part of my application in its entirety along with any dependencies.
- domenkozar 6y agohttps://nix.dev/tutorials/deploying-nixos-using-terraform.html https://nix.dev/tutorials/deploying-nixos-using-terraform.ht... showcases how you can use terraform to provision things and Nix to describe the machine. There's also https://terranix.org/ https://terranix.org/ to configure Terraform using Nix.
- arianvanp 6y agoMaybe https://github.com/serokell/deploy-rs https://github.com/serokell/deploy-rs ? It's a generic deployment tool for Nix that also supports NixOS machines but can target any nix profile
- the_duke 6y agoIn addition to the other comments, there is also nixops. [1] [1] https://github.com/NixOS/nixops https://github.com/NixOS/nixops
- ruuda 6y agoWhat we do at Channable is build our packages with Nix, push them to Cachix, and record the Nix store path. (CI does that automatically for release builds.) Then we use Ansible to declare that that is the store path that we want to realize on the appropriate servers. Our packages contain an "activate" script that updates symlinks in /usr/bin, or systemd units. Ansible calls this script after realizing the store paths. We have some functions written in Nix to help writing these activation scripts, and Nix makes it easy to import them from a Git repository, so we have it in one place and import it in all of our repos. We are now moving towards CD by automatically running Ansible in some cases.