diff --git a/README.md b/README.md index e22c32e..22c0afe 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ Also, the future should include tests in this repo. 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. + + ## Setting up recursive nix Setting up recursive Nix requires support on the build machine: diff --git a/size-test/.gitignore b/size-test/.gitignore new file mode 100644 index 0000000..91ce5dd --- /dev/null +++ b/size-test/.gitignore @@ -0,0 +1,3 @@ +netboot-base +netboot-incremental +netboot-incremental.drv diff --git a/size-test/base.nix b/size-test/base.nix new file mode 100644 index 0000000..f626af7 --- /dev/null +++ b/size-test/base.nix @@ -0,0 +1,3 @@ +{ + imports = [ ../quickly.nix ]; +} diff --git a/size-test/build.sh b/size-test/build.sh new file mode 100755 index 0000000..ca5426c --- /dev/null +++ b/size-test/build.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +set -eux + +cd "$(dirname "$0")" + +nix-build '' \ + -I nixos-config=./base.nix \ + -A config.system.build.ipxeBootDir \ + --out-link ./netboot-base + +nix-instantiate '' \ + -I nixos-config=./incremental.nix \ + -A config.system.build.ipxeBootDir \ + --add-root ./netboot-incremental.drv --indirect + +time nix-build ./netboot-incremental.drv \ + --out-link ./netboot-incremental + +ensureSame() ( + test "$(realpath "./netboot-base/$1")" = "$(realpath "./netboot-incremental/$1")" +) + +ensureSame bzImage +ensureSame initrd + +echo "ok!" diff --git a/size-test/incremental.nix b/size-test/incremental.nix new file mode 100644 index 0000000..e58ac57 --- /dev/null +++ b/size-test/incremental.nix @@ -0,0 +1,4 @@ +{ + imports = [ ./base.nix ]; + services.nginx.enable = true; +}