Convert all 40 `tests/*.nix` files that previously called
`diskoLib.testLib.makeDiskoTest { … }` into pure NixOS modules. Each
test now imports its corresponding `../example/foo.nix` and sets
`disko.test = { name = …; extraChecks = …; nodes.machine = …; … };`
inline.
Switch `tests/default.nix` to discover the module-style tests via
nixpkgs's `nixos/lib/eval-config.nix` and read
`config.system.build.diskoTest` off each. The four bespoke tests
(`make-disk-image`, `make-disk-image-impure`, `mdadm-btrfs-wipe`,
`standalone`) keep their function-call shape and are still imported
imperatively; they don't fit the example-eval pattern.
Arg-to-option translations performed in each file:
- `extraSystemConfig` → `disko.test.nodes.machine`
- `extraInstallerConfig` → `disko.test.nodes.formatter`
- `bootCommands`/`efi`/`enableOCR`/`postDisko`/`enableCanokey`
/`name` → `disko.test.<same>`
- `extraTestScript` → `disko.test.extraChecks`
- `testBoot` → `disko.test.boot`
- `testMode` → `disko.test.mode` (`cli` and `module` set this
explicitly; the rest use the default `"module"`)
- `extraInstallerConfig.networking.hostId` /
`extraSystemConfig.networking.hostId` → host-level
`networking.hostId` (propagated to every node by module.nix's
`defaults.networking.hostId` in the evalTest call)
`tests/cli.nix` and `tests/module.nix` both import
`../example/complex.nix` and override `disko.test.{name,mode,extraChecks}`
with `lib.mkForce` — those overrides will keep working after commit 8
folds `tests/complex.nix`'s `disko.test` block into
`example/complex.nix`.
`tests/zfs-encrypted-root.nix`'s legacy `pkgs.lib.recursiveUpdate` on
the imported disko-config becomes a flat
`disko.devices.zpool.zroot.datasets.root.options.keylocation = …;`
override — the module system merges nested attrs automatically.
Lost capability: `nix-build tests/luks.nix` standalone-build no
longer works (modules aren't directly buildable). Replace with
`nix build .#checks.<system>.luks`.
QEMU on aarch64 requires an explicit machine type (e.g., '-machine virt'),
unlike x86_64 which has a default. Previously, the test script hardcoded
'qemu-kvm' without machine type arguments, causing aarch64 tests to fail
with "No machine specified, and there is no default".
By importing and using nixpkgs' qemu-common.nix library, we reuse the
existing platform-specific QEMU configuration logic.
Originally this was manually applied with;
```sh
nixpkgs-fmt **.nix && statix fix
```
but I overlooked the fact that `**.nix` would only expand to files in
the root (I should have used `**/*.nix`).
Previous commit adds `nix fmt` support which passes `.` to `nixpkgs-fmt`
(if no other path is explicitly specified when running `nix fmt`).
This commit includes the changes made by running `nix fmt`.
As discussed in [this
comment](https://github.com/nix-community/disko/pull/143#discussion_r1097912402),
as a blanket rule converting everything possible to `inherit` like
statements can hurt readability.
Add config file for statix to disable these checks and fixes, then rerun
the autofix with these options.
Apply standard formatting and some statix conventions using;
```sh
nixpkgs-fmt **.nix && statix fix .
```
With the intent of making contribution a bit easier and reducing mental
load in hand formatting (in the same vein as [black]).
[black]: https://github.com/psf/black#the-uncompromising-code-formatter