module: expose diskoTest via system.build

This commit is contained in:
lassulus 2023-07-20 18:32:47 +02:00
parent bfc300b1c2
commit 4cad47f3fa

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, extendModules, ... }@args:
let
diskoLib = import ./lib {
inherit lib;
@ -34,6 +34,16 @@ in
type = lib.types.bool;
default = false;
};
tests = {
efi = lib.mkOption {
description = ''
Whether efi is enabled for the `system.build.installTest`.
We try to automatically detect efi based on the configured bootloader.
'';
type = lib.types.bool;
default = config.boot.loader.systemd-boot.enable || config.boot.loader.grub.efiSupport;
};
};
};
config = lib.mkIf (cfg.devices.disk != { }) {
system.build = (cfg.devices._scripts { inherit pkgs; checked = cfg.checkScripts; }) // {
@ -41,6 +51,14 @@ in
# we keep this old outputs for compatibility
disko = builtins.trace "the .disko output is deprecated, plase use .diskoScript instead" cfg.devices._scripts.diskoScript;
diskoNoDeps = builtins.trace "the .diskoNoDeps output is deprecated, plase use .diskoScriptNoDeps instead" cfg.devices._scripts.diskoScriptNoDeps;
installTest = diskoLib.testLib.makeDiskoTest {
inherit extendModules pkgs;
name = "${config.networking.hostName}-disko";
disko-config = builtins.removeAttrs config ["_module"];
testMode = "direct";
efi = cfg.tests.efi;
};
};