From 6f2ae1e1f2315c93b26b131dabf19e488fb0bb6d Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 17 Jan 2025 15:17:15 +0100 Subject: [PATCH] extend installation-test to check partitioning secrets --- checks/installation/flake-module.nix | 55 ++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/checks/installation/flake-module.nix b/checks/installation/flake-module.nix index efa6c0a3b..0447de9a9 100644 --- a/checks/installation/flake-module.nix +++ b/checks/installation/flake-module.nix @@ -1,6 +1,5 @@ { self, - inputs, lib, ... }: @@ -17,18 +16,68 @@ { lib, modulesPath, ... }: { imports = [ - 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/vda"; environment.etc."install-successful".text = "ok"; nixpkgs.hostPlatform = "x86_64-linux"; boot.consoleLogLevel = lib.mkForce 100; boot.kernelParams = [ "boot.shell_on_fail" ]; + + # disko config + boot.loader.grub.efiSupport = lib.mkDefault true; + boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true; + clan.core.vars.settings.secretStore = "vm"; + clan.core.vars.generators.test = { + files.test.neededFor = "partitioning"; + script = '' + echo "notok" > $out/test + ''; + }; + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/vda"; + + preCreateHook = '' + test -e /run/partitioning-secrets/test/test + ''; + + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; # for grub MBR + priority = 1; + }; + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; }; }; perSystem =