47 Commits
Author SHA1 Message Date
Bert ProesmansandMichael Hoang 8ff2716d01 Fix(test); Add idempotent unmounting to tests of example configuration 2026-05-29 08:41:07 +02:00
Michael Hoang 640d1dd8e0 tests: fix enabling Canokey 2026-05-25 10:55:36 +02:00
Michael Hoang 6795806dbc tests/zfs-with-vdevs: fix not all vdevs detected 2026-05-19 23:33:40 +02:00
a-kenjiandMichael Hoang baf057aa5b lib/tests: stage the test password file under systemd initrd
`boot.initrd.preDeviceCommands` only runs in the script-based stage 1
and is gated on `!config.boot.initrd.systemd.enable`. Tests that
enable systemd initrd therefore never get `/tmp/secret.key` staged,
and disko's encrypted-filesystem mount hooks fail to find the
configured `passwordFile`.
2026-05-19 16:50:50 +02:00
a-kenjiandMichael Hoang 8ebce63228 tests: register dynamically-created machines with the driver
The nixpkgs test driver was refactored: `driver.machines` is now a
computed property that returns a fresh sorted list combining
`driver.machines_qemu` and `driver.machines_nspawn`. Appending to the
property therefore mutates only the temporary returned list, so the
machines created via `create_test_machine` are no longer registered
with the driver.
2026-05-19 16:50:50 +02:00
Raito Bezarius b02541f2d0 feat: add FIDO2 & recovery support for LUKS
This introduces what has been described in
https://0pointer.net/blog/unlocking-luks2-volumes-with-tpm2-fido2-pkcs11-security-hardware-on-systemd-248.html.

That is: support for FIDO2 and recovery passphrases and their boot
mechanism.

Testing is hard right now because of canokey-qemu being broken and U2F
is not a valid replacement for FIDO2…

I tried to keep as much as possible the previous behavior and make it
possible to mix FIDO2 and normal passphrases or key files without any
problem.

PIV support is out of scope for this change but can easily be added.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-04-19 15:26:35 +02:00
luojiyin 29d01f4245 test: fix typo in mkOverride comment 2026-03-05 12:13:09 +08:00
Michael Hoang f2bba803a7 treewide: reformat 2025-12-14 04:58:58 +00:00
Jörg ThalheimandJörg Thalheim a19c2b6d3a tests: use nixpkgs qemu-common for proper machine type configuration
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.
2025-11-20 13:42:11 +00:00
Jörg ThalheimandJörg Thalheim af087d076d disko: drop more eval warnings 2025-11-04 17:23:16 +00:00
Jörg ThalheimandJörg Thalheim 3f65d72ca6 disko/tests: silence mdadm tests 2025-11-04 17:23:16 +00:00
Michael Hoang 67ff9807dd lib: fix mdadm warning when using config.system.build.installTest 2025-09-19 13:18:24 +00:00
DavHauandlassulus ff2d853a84 treewide: format all files 2025-02-15 10:08:56 +00:00
Jörg Thalheim aa006252c8 add unmount feature 2024-11-29 14:44:15 +01:00
Michon van Dooren d192ffd944 Fix zpool create for disk vdev after mirror vdev
A config like

```nix
{
  vdev = [
    {
      mode = "mirror";
      members = [ "data1" "data2" ];
    }
    {
      members = [ "data3" ];
    }
  ];
}
```

would result in the following command:

```shell
zpool create -f <name> mirror /dev/data1 /dev/data2 /dev/data3
```

which would result in a single vdev with a 3-way mirror, rather than a
vdev with a 2-way mirror and a second vdev with a single disk. By
reordering the vdevs to handle those with an empty mode first we
transform this into:

```shell
zpool create -f <name> /dev/data3 mirror /dev/data1 /dev/data2
```

which does have the desired outcome.
2024-11-18 01:33:49 +01:00
Michon van Dooren 9b56c1afdb Add support for ZFS spare, log & dedup vdevs 2024-11-17 15:52:28 +01:00
Jörg Thalheim 6bfa3a18d4 tests/interactive-cryptsetup: make waiting for passphrase more robust 2024-11-08 11:07:09 +01:00
Felix Uhl 94bc0f5bb0 mode destroy: Add confirmation dialogue
The new confirmation dialogue is only shown for the new outputs
introduced in the previous commits. The existing outputs do not change
behavior to keep backwards compatibility.

Fixes #725
2024-11-06 21:16:18 +01:00
Felix Uhl daca7be309 outputs: make compatible with nix run and package lists
This adds new outpus like `format` and `formatNoDeps` which
are compatible with `nix run` so you can do something like

    nix run .#nixosConfigurations.myhostname.config.system.build.formatNoDeps

as originally intended in #78, or add disko to your configuration like

    environment.systemPackages = [
        config.system.build.format
        config.system.build.mount
        config.system.build.destroyFormatMount
    ];

as mentioned in #454.

Fixes part of #454
Supersedes #78

It also deprecates mode `disko` in favor of the clearer
`destroy,format,mount` and adds `format,mount` to allow easier in-place
updates.
2024-11-06 21:16:18 +01:00
Andrew MarshallandFelix Uhl 3979285062 treewide: Fix using pkgs.{build,host}Platform alias
This was recently changed in nixpkgs to be an alias; if nixpkgs is
configured to disable aliases, this usage will fail.
2024-10-29 09:32:41 +01:00
Jörg Thalheim fc3ba6985f only set boot.initrd.preDeviceCommands if we boot with script-based stage1 2024-10-01 09:58:39 +02:00
Jörg Thalheimandmergify[bot] 398acc470f update to new nixos test api 2024-06-07 14:20:40 +00:00
Qubasaandmergify[bot] 9f5d4e45cd nix fmt 2024-04-29 14:57:02 +00:00
lassulus f6b72bfed7 types *: make create idempotent 2024-03-13 09:58:33 +01:00
Jörg Thalheimandmergify[bot] 72818e54ec move disko-install into disko package 2024-03-09 07:05:35 +00:00
lassulus 3cb3775f9b lib/tests: use startCommand for create_machine 2024-03-04 01:51:42 +01:00
Jörg Thalheimandmergify[bot] 590245271a add assertion if mirroredBoots is used in vm test 2024-02-22 00:01:18 +00:00
Jörg Thalheimandmergify[bot] 9ab96378f8 reformat tree 2023-09-17 04:43:25 +00:00
Jörg Thalheimandmergify[bot] ecfb74e5cf remove another instance of hostId 2023-09-02 17:55:49 +00:00
Jörg Thalheim de50df482e do not set networking.hostId in vm tests by default
This will conflict with the user defaults otherwise
2023-09-02 14:16:18 +02:00
Jörg Thalheimandmergify[bot] 358b87fd44 make tests risv64 compatible 2023-08-13 18:30:15 +00:00
Jörg Thalheimandmergify[bot] 241c878d4b drop deprecated boot.initrd.services.swraid.enable option 2023-08-11 08:45:46 +00:00
Jörg Thalheimandmergify[bot] b32f0e2876 apply treefmt 2023-08-11 08:45:46 +00:00
lassulusandmergify[bot] 491e567d47 tests: enable swraid, add luks-on-mdadm test 2023-08-10 11:03:58 +00:00
lassulusandmergify[bot] 0e40d07f86 lib/tests: cleanup 2023-07-28 12:43:42 +00:00
lassulusandmergify[bot] 0d2ae00b00 testLib.makeDiskoTest: remove base & minimal profile 2023-07-28 12:43:42 +00:00
lassulus 7a37b47634 lib makeDiskoTest: create -> format 2023-07-21 14:25:51 +02:00
lassulus 737a21794c lib makeDiskoTest: set networking.hostId to non null value 2023-07-20 21:51:54 +02:00
lassulus 1ddcff717c module: pass makeTest and eval-config to diskoLib 2023-07-20 21:32:53 +02:00
lassulus 2800cf502a tests cli: use direct mode 2023-07-20 19:17:11 +02:00
lassulus 2b728ffe02 libTests prepareDisks: set grub.devices to nodev if empty 2023-07-20 19:03:26 +02:00
lassulus 4df1400b38 makeDiskoTest: remove deprecated grub-devices 2023-07-20 18:31:53 +02:00
lassulus fc98920ef5 lib makeDiskoTest: use systemd-boot if efi is enabled 2023-07-20 18:31:17 +02:00
lassulus 815d018e2f lib makeDiskoTest: allow passing of extendModules 2023-07-20 18:30:55 +02:00
lassulusandmergify[bot] 04452cfd2b tests: refactor to not use args and to use gpt type 2023-07-19 19:07:40 +00:00
lassulusandmergify[bot] 715c211dd7 testLib.makeDiskoTest: split extraConfig into nixos-config, extraSystemConfig & extraInstallerConfig 2023-07-19 19:07:40 +00:00
lassulusandmergify[bot] 056637d3c9 move tests/lib.nix into diskoLib.testLib 2023-07-19 19:07:40 +00:00