outputs: make compatible with nix run and package lists

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.
This commit is contained in:
Felix Uhl
2024-10-18 22:57:34 +02:00
parent 856a290215
commit daca7be309
9 changed files with 123 additions and 33 deletions

View File

@@ -129,7 +129,7 @@ The following step will partition and format your disk, and mount it to `/mnt`.
**Please note: This will erase any existing data on your disk.**
```console
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /tmp/disk-config.nix
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount /tmp/disk-config.nix
```
After the command has run, your file system should have been formatted and

View File

@@ -21,10 +21,12 @@ or else from the disko module of a NixOS configuration of that name under .nixos
Options:
* -m, --mode mode
set the mode, either format, mount or disko
format: create partition tables, zpools, lvms, raids and filesystems
mount: mount the partition at the specified root-mountpoint
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
set the mode, either distroy, format, mount, format,mount or destroy,format,mount
destroy: unmount filesystems and destroy partition tables of the selected disks
format: create partition tables, zpools, lvms, raids and filesystems if they don't exist yet
mount: mount the partitions at the specified root-mountpoint
format,mount: run format and mount in sequence
destroy,format,mount: run all three modes in sequence. Previously known as --mode disko
* -f, --flake uri
fetch the disko config relative to this flake's root
* --arg name value