mirror of
https://github.com/nix-community/disko.git
synced 2026-12-02 14:03:28 +01:00
lib: add install-test machinery (inert)
Three new files that will replace the manual-merging body of
`makeDiskoTest` in lib/tests.nix:
- lib/install-test.nix: pure NixOS test module declaring
the 7 disko convenience knobs
(extraChecks, bootCommands, boot,
efi, postDisko, enableCanokey, mode)
alongside the config that consumes
them. Owns the nodes.{formatter,
machine} blocks and the testScript.
The formatter's `../module.nix`
import is gated on
`config.mode == "module"` —
`direct` mode uses pre-built
standalone CLI scripts and doesn't
need the module's
`system.build.{format,mount,…}`
derivations.
- lib/install-test-formatter.nix: per-node base for the formatter VM
(test-instrumentation + qemu-guest +
swraid + nix.settings tweaks).
Disko module + `disko.enableConfig =
false`/`checkScripts = true` /
forced `disko.devices` are set by
`install-test.nix` only in
`mode = "module"`.
- lib/install-test-machine.nix: per-node base for the booted system
being tested. Imports the disko
module unconditionally (the booted
system always needs disko's
generated fileSystems/boot/swapDevices).
Nothing imports these yet; the files are inert until the next commit
wires `disko.test` as the host eval's submodule pointing at them.
Part of the makeDiskoTest -> evalModules refactor outlined in
`~/.claude/plans/disko-test-refactor.md`.
This commit is contained in:
1 parent
4962f0d92f
commit
7a420ab8b0
3 files changed
+366
No files matched your search
@@ -0,0 +1,48 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ../module.nix ];
|
||||
|
||||
documentation.enable = false;
|
||||
hardware.enableAllFirmware = lib.mkForce false;
|
||||
|
||||
# FIXME: we don't have a systemd in stage-1 equivalent for this
|
||||
boot.initrd.preDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
||||
echo -n 'secretsecret' > /tmp/secret.key
|
||||
'';
|
||||
boot.consoleLogLevel = lib.mkForce 100;
|
||||
|
||||
boot.loader.systemd-boot.graceful = true;
|
||||
|
||||
# we always want the bind-mounted nix store. otherwise tests take forever
|
||||
fileSystems."/nix/store" = lib.mkForce {
|
||||
device = "nix-store";
|
||||
fsType = "9p";
|
||||
neededForBoot = true;
|
||||
options = [
|
||||
"trans=virtio"
|
||||
"version=9p2000.L"
|
||||
"cache=loose"
|
||||
];
|
||||
};
|
||||
boot.zfs.devNodes = "/dev/disk/by-uuid"; # needed because /dev/disk/by-id is empty in qemu-vms
|
||||
|
||||
# Silence mdadm warning about missing MAILADDR or PROGRAM
|
||||
boot.swraid.mdadmConf = "PROGRAM ${pkgs.coreutils}/bin/true";
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
builtins.length config.boot.loader.grub.mirroredBoots > 1 -> config.boot.loader.grub.devices == [ ];
|
||||
message = ''
|
||||
When using `--vm-test` in combination with `mirroredBoots`,
|
||||
it is necessary to configure `boot.loader.grub.devices` as an empty list by setting `boot.loader.grub.devices = lib.mkForce [];`.
|
||||
This adjustment is crucial because the `--vm-test` mechanism automatically overrides the grub boot devices as part of the virtual machine test.
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user