treewide: reformat with nix fmt

This commit is contained in:
Jörg Thalheim 2024-06-09 08:33:26 +02:00 committed by mergify[bot]
parent dd378f1d58
commit 804ab2de77
7 changed files with 31 additions and 20 deletions

View file

@ -41,9 +41,9 @@ recursive layouts.
Disko doesn't require installation: it can be run directly from nix-community Disko doesn't require installation: it can be run directly from nix-community
repository. The [Quickstart Guide](./docs/quickstart.md) documents how to run repository. The [Quickstart Guide](./docs/quickstart.md) documents how to run
Disko in its simplest form when installing NixOS. Alternativly you can Disko in its simplest form when installing NixOS. Alternativly you can also use
also use the new [disko-install](./docs/disko-install.md) tool, which combines the new [disko-install](./docs/disko-install.md) tool, which combines the
the `disko` and `nixos-install` into one step. `disko` and `nixos-install` into one step.
For information on other use cases, including upgrading from an older version of For information on other use cases, including upgrading from an older version of
**disko**, using **disko** without NixOS and downloading the module, see the **disko**, using **disko** without NixOS and downloading the module, see the
@ -120,7 +120,8 @@ This software is provided free under the
## Get in touch ## Get in touch
We have a public matrix channel at [disko](https://matrix.to/#/#disko:nixos.org). We have a public matrix channel at
[disko](https://matrix.to/#/#disko:nixos.org).
--- ---

View file

@ -80,8 +80,8 @@ In the this example we create a flake containing a nixos configuration for
The script will generate the actual image outside of the nix store in the The script will generate the actual image outside of the nix store in the
current working directory. The create image names depend on the names used in current working directory. The create image names depend on the names used in
`disko.devices.disk` attrset in the NixOS configuration. In our code example it will `disko.devices.disk` attrset in the NixOS configuration. In our code example
produce the following image: it will produce the following image:
``` ```
$ ls -la vdb.raw $ ls -la vdb.raw

View file

@ -41,4 +41,3 @@ Options:
* --debug * --debug
run with set -x run with set -x
``` ```

View file

@ -58,16 +58,21 @@ for example like this:
## Remediation ## Remediation
The new GPT layout (`type = "gpt"`) uses partlabels to realize the partiton numbering. For this reason you have to manually set up partition labels, if you want to resolve this issue. The new GPT layout (`type = "gpt"`) uses partlabels to realize the partiton
numbering. For this reason you have to manually set up partition labels, if you
want to resolve this issue.
### Create GPT partition labels ### Create GPT partition labels
For each partition involved, create the partition label from these components: For each partition involved, create the partition label from these components:
- The partition number (e.g. /dev/nvme0n**1**, or /dev/sda**1**) - The partition number (e.g. /dev/nvme0n**1**, or /dev/sda**1**)
- The parent type in your disko config (value of `disko.device.disk.example.type = "disk";`) - The parent type in your disko config (value of
- The parent name in your disko config (attribute name of `disko.devices.disk.example`, so `example` in this example) `disko.device.disk.example.type = "disk";`)
- The partition name in your disko config (attribute name of `disko.devices.disk.content.partitions.*.name`) - The parent name in your disko config (attribute name of
`disko.devices.disk.example`, so `example` in this example)
- The partition name in your disko config (attribute name of
`disko.devices.disk.content.partitions.*.name`)
```bash ```bash
# sgdisk -c 1:disk-example-ESP /dev/nvme0n1 # sgdisk -c 1:disk-example-ESP /dev/nvme0n1
@ -84,14 +89,18 @@ Make the following changes to your disko configuration:
1. Set `disko.devices.disk.example.content.type = "gpt"` 1. Set `disko.devices.disk.example.content.type = "gpt"`
1. Remove `disko.devices.disk.example.format` 1. Remove `disko.devices.disk.example.format`
1. Convert `disko.devices.disk.example.partitions` to an attribute set and promote the `name` field to the key for its partition 1. Convert `disko.devices.disk.example.partitions` to an attribute set and
1. Add a `priority` field to each partition, to reflect the intended partition number promote the `name` field to the key for its partition
1. Add a `priority` field to each partition, to reflect the intended partition
number
Then rebuild your system and reboot. Then rebuild your system and reboot.
### Recovering from mistake ### Recovering from mistake
If you made a mistake here, your system will be waiting for devices to appear, and then run into timeouts. You can easily recover from this, since rebooting into an old generation will still use the legacy way of numbering of partitions. If you made a mistake here, your system will be waiting for devices to appear,
and then run into timeouts. You can easily recover from this, since rebooting
into an old generation will still use the legacy way of numbering of partitions.
## Result ## Result

View file

@ -53,8 +53,8 @@ let
boot.loader.efi.canTouchEfiVariables = lib.mkVMOverride writeEfiBootEntries; boot.loader.efi.canTouchEfiVariables = lib.mkVMOverride writeEfiBootEntries;
boot.loader.grub.devices = lib.mkVMOverride diskoSystem.config.boot.loader.grub.devices; boot.loader.grub.devices = lib.mkVMOverride diskoSystem.config.boot.loader.grub.devices;
imports = [ imports = [
({ _file = "disko-install --system-config"; } // (builtins.fromJSON extraSystemConfig)) ({ _file = "disko-install --system-config"; } // (builtins.fromJSON extraSystemConfig))
]; ];
} }
) )
]; ];

View file

@ -82,9 +82,11 @@ let
QEMU_OPTS = lib.concatStringsSep " " ([ QEMU_OPTS = lib.concatStringsSep " " ([
"-drive if=pflash,format=raw,unit=0,readonly=on,file=${pkgs.OVMF.firmware}" "-drive if=pflash,format=raw,unit=0,readonly=on,file=${pkgs.OVMF.firmware}"
"-drive if=pflash,format=raw,unit=1,file=efivars.fd" "-drive if=pflash,format=raw,unit=1,file=efivars.fd"
] ++ builtins.map (disk: ] ++ builtins.map
"-drive file=${disk.name}.raw,if=virtio,cache=unsafe,werror=report,format=raw" (disk:
) (lib.attrValues nixosConfig.config.disko.devices.disk)); "-drive file=${disk.name}.raw,if=virtio,cache=unsafe,werror=report,format=raw"
)
(lib.attrValues nixosConfig.config.disko.devices.disk));
in in
{ {
pure = vmTools.runInLinuxVM (pkgs.runCommand name pure = vmTools.runInLinuxVM (pkgs.runCommand name

View file

@ -4,7 +4,7 @@ let
dependencies = [ dependencies = [
self.nixosConfigurations.testmachine.pkgs.stdenv.drvPath self.nixosConfigurations.testmachine.pkgs.stdenv.drvPath
(self.nixosConfigurations.testmachine.pkgs.closureInfo { rootPaths = []; }).drvPath (self.nixosConfigurations.testmachine.pkgs.closureInfo { rootPaths = [ ]; }).drvPath
self.nixosConfigurations.testmachine.config.system.build.toplevel self.nixosConfigurations.testmachine.config.system.build.toplevel
self.nixosConfigurations.testmachine.config.system.build.diskoScript self.nixosConfigurations.testmachine.config.system.build.diskoScript
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);