Continuos Integration for nixos?


I have decided to experiment with nixos after being blown away by the nixos-anywhere project.

The interest is driven by the declarative approach of nixos, in order words same flake.nix file will give exactly the same OS, top to bottom.

I would like to store the flake files in a git repository.

Therefore, when a modification is made, I would like to:

  1. check the formatting of the code: currently I am using nixfmt and statix, any other suggestions?
  2. will the code actually generate a working system? any suggestion?
  3. get a diff, for example:
    • package A will be updated from version X to Y
    • package B is installed
    • package C is removed
    • a new service is created with this config

all running a gitlab/github pipeline.

I was able to get something similar by running on the system itself:

nix flake lock --update-input nixpkgs
nix build ""
nix store diff-closures /run/current-system ./result

But I am just able to see package version changes not the entire configuration of the system.


1 Like