362 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
Bert ProesmansandMichael Hoang 2c40806b93 feat(mdadm); start mdadm before mounting datasets 2026-05-29 08:41:07 +02:00
Bert ProesmansandMichael Hoang 5c7406ecc5 Fix(zfs_volume); Volume mount/unmount with encryption
- Fix consistent use of fully qualified dataset path
- Add idempotent unmounting with encryption keys
2026-05-29 08:41:07 +02:00
Bert ProesmansandMichael Hoang 03e19b4f67 Feature(zfs_volume); Add internal option for fully qualified zfs path 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 7da3d737f7 luks: fix not asking for password in format script 2026-05-20 00:19:04 +02:00
Michael Hoang 0d15976fce luks: don't depend on autogenerated password 2026-05-20 00:14:40 +02:00
Michael Hoang d60b2b5e00 luks: improve idempotency for enrolling FIDO2
Using FIDO2 automatically generates a temporary password for setting up LUKS
which is not available on subsequent runs of the script causing the format
script to crash with `password: unbound variable`.
2026-05-20 00:07:06 +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 403186440c lib/types/bcachefs_filesystem: tolerate already-unlocked filesystem 2026-05-19 16:50:50 +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
June Stepp 4c81091646 make-disk-image: don't build native /etc.
Grab just the udev part.
2026-05-16 09:07:05 -05:00
SandroandGitHub 1be7610ee9 Remove alias usage 2026-05-02 01:02:39 +02:00
lassulusandGitHub ce160f5185 Fix failing ShellCheck for LUKS partitions (#1250)
Trivial fix
2026-04-19 15:42:53 +00: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
magic_rb 47deadb7c1 Fix failing ShellCheck for LUKS partitions
Signed-off-by: magic_rb <magic_rb@redalder.org>
2026-04-13 14:23:41 +02:00
Jörg ThalheimandGitHub 878ec37d6a Escape ZFS args (#1222)
Args to ZFS (like mountpoints) might have spaces or other
shell-unfriendly characters in them. This escapes those so they get
passed to zfs correctly.
2026-03-14 16:38:37 +00:00
Jörg ThalheimandGitHub c4d34f2031 fix: correct typos across docs and messages (#1229)
## Summary

This PR fixes typos in docs and user-facing messages.

## Detailed Changes

| File | Fixed |
|---|---|
| `scripts/create-release.nix` | `uncommited` -> `uncommitted` (4x) |
| `lib/default.nix:906` | `Depracated` -> `Deprecated` |
| `lib/tests.nix:195` | `mkOveride` -> `mkOverride` |
| `docs/interactive-vm.md:3` | `similiar` -> `similar` |
| `docs/disko-images.md:82` | `involed` -> `involved` |
| `docs/disko-images.md:110` | `scirpt` -> `script` |
| `docs/table-to-gpt.md:62` | `partiton` -> `partition` |
| `lib/make-disk-image.nix:212` | `involed` -> `involved` |
| `docs/disko-images.md:11` | `In the this example` -> `In this example`
|

No intended behavior change.

Closes #1228
2026-03-14 16:34:36 +00:00
lassulusandGitHub eaafb89b56 Mount file-systems in the correct order (#1057)
Use the `fsBefore` function from NixOS to sort the file-systems.
The function originates from `nixpkgs/nixos/lib/utils.nix`, but the file
is a lambda that requires more arguments than we have available.
2026-03-07 07:05:52 +00:00
Francesco Zanini 0597c9262e Mount file-systems in the correct order
Use the `fsBefore` function from NixOS to sort the file-systems.
The function originates from `nixpkgs/nixos/lib/utils.nix`, but the file
is a lambda that requires more arguments than we have available.
2026-03-05 09:33:32 +01:00
lassulusandGitHub 42affa9d33 Better handling of bind mounts in make-disk-image (#1056)
The device of the bind mounts is incorrectly taken verbatim while making
the image. The root hierarchy is mounted at `config.rootMountDir`
(`/mnt` by default) during the process, and this commit prepends that
path to the `device` in these cases.
2026-03-05 08:25:10 +00:00
luojiyin 29d01f4245 test: fix typo in mkOverride comment 2026-03-05 12:13:09 +08:00
luojiyin 6be2229087 fix: correct typo in disk image help text 2026-03-05 12:13:08 +08:00
luojiyin 8b94abcd23 fix: correct deprecation typo in lib default 2026-03-05 12:13:08 +08:00
Josh Gustafson dff80bbcd9 Escape ZFS args 2026-03-02 09:31:30 -07:00
Michael Hoang ec90d55ff3 lib: pass stdenv to qemu-common not pkgs 2026-01-20 12:57:44 +00:00
Michael Hoang 5ae05d98d2 treewide: reformat 2026-01-20 12:57:44 +00:00
Jörg ThalheimandJörg Thalheim 916506443e make-disk-image: quote $rootMountPoint for consistency
All other usages of $rootMountPoint in this file are quoted, so apply
the same style here for readability.
2025-12-19 13:25:02 +00:00
Jörg ThalheimandJörg Thalheim 6b172212b6 disko-install: resolve symlinks in mount point path
Nix refuses to operate when the store path or its parent directories
contain symlinks. On some systems /mnt can be a symlink, causing
disko-install to fail with:

  error: the path '"/mnt"' is a symlink; this is not allowed for the
  Nix store and its parent directories

Use realpath to resolve symlinks before passing the mount point to
nix-store and nixos-install commands.
2025-12-19 13:25:02 +00:00
qbisiandJörg Thalheim 7194cfe5b7 downgrade the priority of kernelPackages set from imageBuilder 2025-12-15 10:34:05 +00:00
nothingnessesandMichael Hoang be1a6b8a05 bcachefs: fix subvolume mounting 2025-12-14 04:58:58 +00:00
Michael Hoang f2bba803a7 treewide: reformat 2025-12-14 04:58:58 +00:00
fidgetingbitsandMichael Hoang e65362ceef feat(mdadm): add extraArgs option 2025-12-10 00:31:19 +00:00
Jörg ThalheimandJörg Thalheim 8e68aa819d disko-images: add copyNixStoreThreads option for configurable parallelism
Allow users to override the automatic thread count detection for nix
store copying. The default "auto" behavior remains unchanged (min of
nproc and 8), but users can now specify a fixed thread count for
environments where the automatic detection isn't optimal.
2025-12-09 08:59:57 +00:00
Jörg ThalheimandJörg Thalheim 10cdd63203 disko-images: switch back from xcp to cp for improved stability 2025-12-09 08:59:57 +00:00
Bert ProesmansandJörg Thalheim a799338d17 fix(luks); Passthrough filesystems of content for unmounting 2025-11-20 14:10:46 +00:00
Bert ProesmansandJörg Thalheim fa7a23d0ef fix(nodev); Set device default to fstype config
The value for device is copied into the SOURCE column of findmnt.
By default this is "none". The mount and unmount scripts
branch on SOURCE=fsType specifically, and the existence of "none"
in the SOURCE column causes wrong branches to be executed.
For a list of special filesystems, the default value "none"
is replaced by the value for fsType.
2025-11-20 14:10:46 +00:00
Bert ProesmansandJörg Thalheim d9e12a2c7f fix(zpool); Ignore shadow-mount error during recreate of zpool at existing non-empty path 2025-11-20 14:10:46 +00:00
Bert ProesmansandJörg Thalheim d8a3e367bd Fix(mdadm); unmount not passing through filesystems set from content 2025-11-20 14:10:46 +00:00
Bert ProesmansandJörg Thalheim 436fd911cf Fix(zfs_fs); Mount/Unmount with encryption
- Fix typo against full dataset path argument
- Make unmount with encryption keys idempotent
2025-11-20 14:10:46 +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
Francesco ZaniniandJörg Thalheim 6f4cf5abbe Set kernelPackages in native builder
In some cases, the kernel is not defined for cross-arch builds.
2025-10-31 08:29:56 +00:00
Edwin Mackenzie-OwenandJörg Thalheim fec5efebfc gpt: trigger udev after marking hybrid mbr partitions as bootable
Even though we don't depend on the MBR bootable flag in the following
steps, not running udevadm trigger and waiting for settle can cause
/dev/disk/by-partlabel entries to be absent when formatting filesystems
immediately after modifying the partition table.
2025-10-31 08:24:29 +00:00
Gabriel NütziandMichael Hoang 3a9450b26e fix: forward arguments to vmWithDisko 2025-10-17 11:39:50 +00:00
Michael Hoang 67ff9807dd lib: fix mdadm warning when using config.system.build.installTest 2025-09-19 13:18:24 +00:00
Sergey KazenyukandJörg Thalheim 31fe7eda26 gpt: add partition attributes 2025-09-07 14:37:19 +00:00
Jörg ThalheimandJörg Thalheim a5c4f2ab72 make-disk-image: use modules output of a kernel if present
This is a hotfix that could be reverted if we get:

https://github.com/NixOS/nixpkgs/pull/439178

in.
2025-09-01 13:33:49 +00:00