Independent update of nixos-container configurations

Recently started using nixos-container to test/review NixOS modules PRs, it’s great! Example:

{
  description = "NixOS container";

  inputs = {
    nixpkgs.url = "git+file:///home/tom/nixpkgs";
  };

  outputs = { self, nixpkgs }: {
      nixosConfigurations.container = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [({pkgs, config, ... }: {
          boot.isContainer = true;
          networking.useDHCP = false;
      })];
    };
  };
}


and I can use a flake to speed things up. This is much faster and less hassle than rebuilding a host machine.

nixos-container update nixreview --flake . --impure
nixos-container root-login nixreview
3 Likes