Create full netboot images in 15 seconds.
Go to file
2020-06-08 10:02:39 -04:00
pkgs Load the Nix database registration too, and let the GC test pass. 2020-06-08 09:40:06 -04:00
size-test Add a test to confirm the initrd's are the same, and that rebuilds are fast 2020-06-08 09:57:02 -04:00
quickly.nix Explain why we copy out of the mount 2020-06-08 09:59:02 -04:00
README.md Document how to use 2020-06-08 10:02:39 -04:00
test.nix Check that the store registration works (it doesn't.) 2020-06-08 09:17:49 -04:00

netboot.nix

Alternative expressions for netboot.

In the future, I'd like to structure this as a module, to easily turn on recursive Nix builds, or target a ZFS filesystem, etc.

Also, the future should include tests in this repo.

Included Module Expressions

  • ./quickly.nix uses recursive Nix to build the initrd and squashfs filesystems more quickly, allowing for faster iteration of images. Initial testing reduced build time from 5-10 minutes per image to 15-30 seconds.

    The ./size-test/build.sh test is able to build an incremental netboot image in just 12 seconds, and the initrd is not rebuilt.

How to Use

First set up recursive nix on your builder. Then:

$ nix-build '<nixpkgs/nixos>' -I nixos-config=./size-test/base.nix -A config.system.build.ipxeBootDir

and boot off of ./result/netboot.ipxe. The initial build may take a few minutes, but subsequent builds will only take a few seconds.

Setting up recursive nix

Setting up recursive Nix requires support on the build machine:

{ pkgs, ... }: {
  nix = {
    package = pkgs.nixUnstable;
    systemFeatures = [ "recursive-nix" "kvm" "nixos-test" ];
    extraOptions = ''
      experimental-features = recursive-nix
    '';
  };
}