Misterio77 / nix-config

Personal nixos and home-manager configurations.
https://m7.rs/git/nix-config/
MIT License
719 stars 42 forks source link

Ci/Cd? #16

Closed prescientmoon closed 1 year ago

prescientmoon commented 1 year ago

I see you are using hydra. I'm yet to set it up myself, but as far as I can understand it let's you build nix stuff automatically. Does your setup have a way to automatically deploy your website and other things? (or do you manually call the deploy script whenever you feel like it?)

Misterio77 commented 1 year ago

I do have CD! It's a pull-based deployment, that means the machines auto-upgrade themselves from hydra.

I basically have my hydra run a script that pushes release branches corresponding to each host's name (e.g. release-atlas).

I then point system.autoUpgrade.flake to the correct branch, for example:

{ config, ... }: {
  system.autoUpgrade = {
    enable = true;
    flake = "github:you/nix-config/release-${config.networking.hostName}";
  };
}

And there you have it, pull based deployment. I think someone should create something like system.autoUpgrade.hydraJob though, would make things a lot easier.