From c2a60dcbb6f6224fa7c6e832854c23f3be6a7a29 Mon Sep 17 00:00:00 2001 From: DavHau Date: Wed, 13 Nov 2024 20:39:44 +0700 Subject: [PATCH] tests: minify test machines to decrease runtime --- checks/installation/flake-module.nix | 1 + checks/lib/container-test.nix | 4 +++- checks/lib/minify.nix | 7 +++++++ checks/lib/test-base.nix | 4 +++- lib/build-clan/module.nix | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 checks/lib/minify.nix diff --git a/checks/installation/flake-module.nix b/checks/installation/flake-module.nix index 89b5074d1..80e04fe29 100644 --- a/checks/installation/flake-module.nix +++ b/checks/installation/flake-module.nix @@ -15,6 +15,7 @@ self.clanModules.single-disk (modulesPath + "/testing/test-instrumentation.nix") # we need these 2 modules always to be able to run the tests (modulesPath + "/profiles/qemu-guest.nix") + ../lib/minify.nix ]; clan.single-disk.device = "/dev/vdb"; diff --git a/checks/lib/container-test.nix b/checks/lib/container-test.nix index 27cb19590..f9771ddad 100644 --- a/checks/lib/container-test.nix +++ b/checks/lib/container-test.nix @@ -10,7 +10,9 @@ in hostPkgs = pkgs; # speed-up evaluation defaults = { - nix.package = pkgs.nixVersions.latest; + imports = [ + ./minify.nix + ]; documentation.enable = lib.mkDefault false; boot.isContainer = true; diff --git a/checks/lib/minify.nix b/checks/lib/minify.nix new file mode 100644 index 000000000..7edaa346b --- /dev/null +++ b/checks/lib/minify.nix @@ -0,0 +1,7 @@ +{ + nixpkgs.flake.setFlakeRegistry = false; + nixpkgs.flake.setNixPath = false; + nix.registry.nixpkgs.to = { }; + documentation.doc.enable = false; + documentation.man.enable = false; +} diff --git a/checks/lib/test-base.nix b/checks/lib/test-base.nix index edde37012..0aef4cac8 100644 --- a/checks/lib/test-base.nix +++ b/checks/lib/test-base.nix @@ -8,9 +8,11 @@ in hostPkgs = pkgs; # speed-up evaluation defaults = { + imports = [ + ./minify.nix + ]; documentation.enable = lib.mkDefault false; nix.settings.min-free = 0; - nix.package = pkgs.nixVersions.latest; }; # to accept external dependencies such as disko diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 079a7762c..3951b2085 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -68,7 +68,7 @@ let nixpkgs.hostPlatform = lib.mkIf (system != null) (lib.mkDefault system); # speeds up nix commands by using the nixpkgs from the host system (especially useful in VMs) - nix.registry.nixpkgs.to = { + nix.registry.nixpkgs.to = lib.mkDefault { type = "path"; path = lib.mkDefault nixpkgs; };