Set dirty_bytes and dirty_background_bytes to low thresholds (10MB/5MB)
before copying the nix store into the VM image. This forces the kernel
to write back dirty pages almost immediately instead of letting them
accumulate. Clean page cache is evicted automatically under memory
pressure, so this prevents OOM even when copying files larger than
available VM RAM.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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