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.
The type keyword was included before every vdev:
```shell
zpool create -f <name> /dev/sda log mirror /dev/sdb /dev/sdc log mirror /dev/sdd /dev/sde
```
but this is incorrect and should instead be:
```shell
zpool create -f <name> /dev/sda log mirror /dev/sdb /dev/sdc mirror /dev/sdd /dev/sde
```
Fixes#871
Previously, if a user used v2.10.0 (currently unreleased master), an
error like this would be displayed:
error: attribute '_cliDestroyFormatMount' missing
at /nix/store/fbqgaij9d3b373rq1iav5glzr4dy77qf-disko/share/disko/cli.nix:73:7:
72| else if (lib.traceValSeq hasDiskoModuleFlake) then
73| (builtins.getFlake flake).nixosConfigurations.${flakeAttr}.config.system.build.${diskoAttr}
| ^
74| else
This situation now produces a more helpful error:
Error: Attribute `nixosConfigurations.testmachine.config.system.build._cliDestroyFormatMount`
not found in flake `/home/felix/repos-new/disko`!
This is probably caused by the locked version of disko in the flake
being different from the version of disko you executed.
EITHER set the `disko` input of your flake to `github:nix-community/disko/latest`,
run `nix flake update disko` in the flake directory and then try again,
OR run `nix run github:nix-community/disko/v1.9.0 -- --help` and use one of its modes.
Fixes regression introduced in daca7be309
that would cause the following behavior:
$ ./disko --mode disko --dry-run example/simple-efi.nix
/nix/store/syiv3fhzd7ar2nk5pbh56gswcs4fzvxs-disko/bin/*
Now, it returns the correct script path again:
$ ./disko --mode disko --dry-run example/simple-efi.nix
/nix/store/syiv3fhzd7ar2nk5pbh56gswcs4fzvxs-disko
I believe that people are either using disko through the flake or via
nixpkgs. In both cases, the `default.nix` file contains a lot of outputs
that are not needed.
Adding scary error messages with a call to action like this should help
confirm or deny this theory.
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
https://github.com/NixOS/nixpkgs/commit/65c851cd7523c669b8fb25236b1c48283a2f43ec,
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