Commit graph

333 commits

Author SHA1 Message Date
Jö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 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
qbisi
7194cfe5b7 downgrade the priority of kernelPackages set from imageBuilder 2025-12-15 10:34:05 +00:00
nothingnesses
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
fidgetingbits
e65362ceef feat(mdadm): add extraArgs option 2025-12-10 00:31:19 +00:00
Jö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 Thalheim
10cdd63203 disko-images: switch back from xcp to cp for improved stability 2025-12-09 08:59:57 +00:00
Bert Proesmans
a799338d17 fix(luks); Passthrough filesystems of content for unmounting 2025-11-20 14:10:46 +00:00
Bert Proesmans
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 Proesmans
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 Proesmans
d8a3e367bd Fix(mdadm); unmount not passing through filesystems set from content 2025-11-20 14:10:46 +00:00
Bert Proesmans
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 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 Thalheim
af087d076d disko: drop more eval warnings 2025-11-04 17:23:16 +00:00
Jörg Thalheim
3f65d72ca6 disko/tests: silence mdadm tests 2025-11-04 17:23:16 +00:00
Francesco Zanini
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-Owen
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ützi
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 Kazenyuk
31fe7eda26 gpt: add partition attributes 2025-09-07 14:37:19 +00:00
Jö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
Jörg Thalheim
bafad29f89 make-disk-image: also use xcp 2025-08-25 09:53:42 +00:00
lassulus
4073ff2f48 types.luks: fix password check 2025-08-18 12:26:12 +00:00
Glen Huang
3db2f04765 allow subtype definitions to be broken up 2025-07-21 12:13:55 +00:00
Scott Edlund
8fd2d6c750 make-disk-image: QEUM_OPTS -> QEMU_OPTS 2025-06-23 12:03:50 +00:00
Mitch Fossen
d74db625a5 remove quotes from --label creation for bcachefs
fixes device groups, for example where the disko config given looks like:

label = "fast.dev1";

after formatting, the device has a literal label of "fast.dev1" which
breaks bcachefs device groups:

echo fast > /sys/fs/bcachefs/<id>/options/foreground_target

gives the error Invalid argument, echo fast.dev1 fails as well

echo "\"fast\"" fails the same, however echo "\"fast.dev1\"" succeeds

after this, device labels and groups work as expected and any component
of the label can be used for a *_target
2025-06-05 18:16:20 +00:00
Jörg Thalheim
6bb82b77ce luks: drop unnecessary subshell 2025-05-08 09:13:14 +00:00
Philipp Schmitt
06fb9283ca Unlock luks devices once and only once 2025-05-08 09:13:14 +00:00
Philipp Schmitt
69265ccde5 Fix _destroy 2025-05-08 09:13:14 +00:00
Philipp Schmitt
cbc1f418d0 Improve luks device detection 2025-05-08 09:13:14 +00:00
Philipp Schmitt
aa5d53aee8 Add disk.destroy option 2025-05-08 09:13:14 +00:00
Jörg Thalheim
c7e0b00007 diskoImagesScript: unset NIX_REMOTE
for some reason this is set and breaks running disko outside of the vm
2025-05-08 09:07:26 +00:00
Kyle Petryszak
8d78963819 fix: addresses: https://github.com/koverstreet/bcachefs/issues/812 2025-05-07 17:27:41 +00:00
nothingnesses
7b63642358 Make bcachefs subvolumes boot-time mount tests pass + more tests 2025-05-04 20:24:55 +00:00
nothingnesses
ca27b88c88 Add bcachefs type with encryption and multi-disk support
This update introduces a bcachefs type with encryption support and advanced formatting options.
It includes a new example (`examples/bcachefs-multi-disk.nix`) to demonstrate multi-disk setups and available options.

Key changes:

- Deterministic UUID generation.
- Addressed limitations with multi-disk root setups due to bcachefs and systemd issues.
- Provided a systemd-mount alternative for fileSystems configuration.
- Added subvolume support and updated scripts for clarity and functionality.

---------

Co-authored-by: Jonas Heinrich <onny@project-insanity.org>
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
Co-authored-by: Kyle Petryszak <6314611+ProjectInitiative@users.noreply.github.com>

Update
* Add examples
* Improve descriptions

Remove debugging

Remove comment

Use `unique` to dedup lists
2025-04-24 13:41:42 +00:00
Jeremy Fleischman
51d33bbb7f UI nit: remove unnecessary newline when prompting user for password 2025-04-18 01:42:02 +00:00
Jörg Thalheim
76c0a6dba3 udevadm settle: use timeout
there are cases where this can just indefinitly hang as we can see in VM
tests. Let's add a tie breaker.
2025-04-08 20:46:43 +00:00
Jörg Thalheim
8f806681d7 tree-wise: quote path correctlys 2025-04-08 15:36:04 +00:00
Ari Gato
329d3d7e8b interactive-vm: use disk.imageName instead of .name
Avoids a "No such file or directory" if a configuration uses a named disk image.
2025-04-02 12:57:47 +00:00
meck
9a7ab516cf Set buildPlatform in make-disk-image
Currently if building an image using cross compilation:

nixpkgs = {
  config.allowUnsupportedSystem = true;
  hostPlatform = "armv7l-linux";
  buildPlatform = "x86_64-linux";
};

And resetting the Disko packages for binFmt use:

disko.imageBuilder =
  let
    diskoPkgs = nixpkgs.legacyPackages."x86_64-linux";
  in
  {
    enableBinfmt = true;
    pkgs = diskoPkgs;
    kernelPackages = diskoPkgs.linuxPackages_latest;
  };

Something will differ between host/build Platform in diskoPkgs (Not sure
what, they look the same when tracing but there is functions that maybe
differ) causing it to miss the nixpkgs cache and rebuilding for x86_64-linux.
Also resettings buildPlatform fixes this.
2025-03-12 08:35:27 +01:00
rszyma
19c1140419 fix schellcheck warning failing build 2025-02-25 12:19:28 +00:00
lassulus
fa5746ecea types disk: fix deviceOrdering 2025-02-15 15:53:51 +00:00
DavHau
ff2d853a84 treewide: format all files 2025-02-15 10:08:56 +00:00
Rua
a825e29a3b Use regex for UUID, adjust documentation a bit 2025-02-15 01:27:47 +00:00
Rua
bf440582c4 Use concatMapStrings 2025-02-15 01:27:47 +00:00
Rua
54be8abff0 Add configration option for partition UUIDs 2025-02-15 01:27:47 +00:00
danjujan
e51159153b make-disk-image: format natively 2025-02-14 10:39:29 +00:00
Sávio
6438340415 make-disk-image: add binfmt emulation 2025-02-14 10:39:29 +00:00
lassulus
85942f35d3 Revert "Fix: Device dependencies not sorting correctly"
This reverts commit 40da43e8e5.
2025-02-14 07:40:53 +00:00