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
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.
Previously, an error like
error: function 'anonymous lambda' called with unexpected argument 'customQemu'
at /nix/store/lbqj1cndic4121whnx8xm0jgb1c8x4xx-source/pkgs/build-support/vm/default.nix:1:1:
was printed when trying to evaluate `config.system.build.vmWithDisko` or
`config.system.build.diskoImagesScript` with nixpkgs 24.05 (and below).
This argument was added in
65c851cd75,
so technically the minimum version is 24.11.20240708.65c851c. However,
`versionAtLeast` only compares versions alphabetically, so the comparison's
result will be incorrect for other commits made on the same day.
Instead, we compare against 24.11.20240709, which is the next day.
This means this function returns false for some commits that DO support the
customQemu argument, but if it returns true, we can be 100% certain that this
is correct, and we can pass the customQemu argument to vmTools without an
evaluation error.
Fixes#850
lvcreate -l does not accept a '100%' parameter which currently leads to a crash. THis change automatically changes `100%` to `100%FREE` leading to the intended behavior.
because it breaks evaluation on darwin with at least nix 2.18.
Evaluating `lib.splitString "" "foo"` throws the following:
`error: invalid regular expression ''`.
We could avoid that by using lib.stringToCharacters, but as
we are mapping over it anyway, lib.stringAsChars seems to be
an even better fit.
I tested the examples in hexEscapeUdevSymlinks docstring manually
in a nix repl.
Fixes#130
This should fix pretty much all cases where spaces or other special
characters would break disko due to improper quoting. I searched for all
instances of '.label', '.device' and '.name', so I believe I caught
whatever I could.
In some cases I changed single quotes to double quotes for consistency.
I know we don't usually fix bugs in the legacy table type, but it was so
easy I couldn't resist.
For disk type, option name used in disk partlabel
naming should be short. While setting a specialized
option imageName allow us to create image with long name
without side-effects.
Some users will have `boot.zfs.forceImportRoot = false;` in their
configurations which conflicts with `boot.zfs.forceImportAll = true;`,
so we set it to `true` to match.
Usually this is added by nixos-generate-config.
However now that we run nixos-generate-config before disko or we even
run nixos-facter, we likely not see the LVM block devices anymore.
Use `zfs set -u` to update the `mountpoint` flag without mounting or
unmounting the filesystem. This flag was added in OpenZFS 2.2.0, which
was released October 2023.
The previous logic would not update `mountpoint` if `config.options` was
empty or only contained `mountpoint`.
As `makeDiskImages` always requires a NixOS configuration, we can
simplify the code by convering it into a NixOS module. Then we can make
it responsible for populating `system.build.diskoImages` and
`system.build.diskoImagesScript`.
This is not an issue when initially creating the partition because
device mapper will just map on top of the filesystem, but it breaks
incremental updates because the check for `TYPE=` will fail, and the
subsequent attempt to run `mkswap` also fails:
mkswap: cannot open /dev/disk/by-partlabel/disk-nix-store-swap: Device or resource busy
Instead, just don't do anything, NixOS will take care of it.
Running `zfs set mountpoint=/mnt/my-ds tank/my-ds`, ZFS may try to
unmount the dataset even if the mountpoint didn't change.
To avoid the confusing error message, this command is now only run when
the mountpoint actually changes.
This is needed to prevent two layers of emulation when offering a build for a host running binfmt such as an x86 host trying to compile for aarch64 via binfmt