This commit is contained in:
Qubasa
2024-04-21 21:25:44 +02:00
committed by mergify[bot]
parent 35d4378e74
commit 9f5d4e45cd
12 changed files with 263 additions and 250 deletions

View File

@@ -70,8 +70,8 @@ and made a note of its URL.
Your configuration needs to be saved on the new machine for example
as /tmp/disk-config.nix. You can do this using the `curl` command to download
from the url you noted above, using the `-o` option to save the file as
disk-config.nix. Your commands would look like this if you had chosen the
hybrid layout:
disk-config.nix. Your commands would look like this if you had chosen the hybrid
layout:
```console
cd /tmp
@@ -182,8 +182,8 @@ of the NixOS manual. The following configuration for `grub` works for both EFI
and BIOS systems. Add this to your configuration.nix, commenting out the
existing lines that configure `systemd-boot`. The entries will look like this:
**Note:** Its not necessary to set `boot.loader.grub.device` here, since Disko will
take care of that automatically.
**Note:** Its not necessary to set `boot.loader.grub.device` here, since Disko
will take care of that automatically.
```nix
# ...

View File

@@ -51,9 +51,11 @@ generate disk images:
### Generating the `.raw` VM Image
1. **Create a NixOS configuration that includes the disko and the disk configuration of your choice**
1. **Create a NixOS configuration that includes the disko and the disk
configuration of your choice**
In the this example we create a flake containing a nixos configuration for `myhost`.
In the this example we create a flake containing a nixos configuration for
`myhost`.
```nix
# save this as flake.nix
@@ -86,15 +88,15 @@ In the this example we create a flake containing a nixos configuration for `myho
}
```
2. **Build the disko image script:** Replace `myhost` in the command below with your
specific system configuration name:
2. **Build the disko image script:** Replace `myhost` in the command below with
your specific system configuration name:
```console
nix build .#nixosConfigurations.myhost.config.system.build.diskoImagesScript
```
3. **Execute the disko image script:** Execute the generated disko image script. Running
`./result --help` will output the available options:
3. **Execute the disko image script:** Execute the generated disko image script.
Running `./result --help` will output the available options:
```console
./result --help
@@ -124,9 +126,10 @@ In the this example we create a flake containing a nixos configuration for `myho
sudo ./result --build-memory 2048
```
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 `disko.devices.disk` attrset in the NixOS configuration.
In our code example it will produce the following image:
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
`disko.devices.disk` attrset in the NixOS configuration. In our code example it will
produce the following image:
```
$ ls -la vdb.raw
@@ -142,8 +145,8 @@ In the this example we create a flake containing a nixos configuration for `myho
```
- If the `.raw` image size is not optimal, use `--write-to-disk` to write
directly to a drive. This bypasses the `.raw` file generation, which saves on read/write operations
and is suitable for single disk setups.
directly to a drive. This bypasses the `.raw` file generation, which saves on
read/write operations and is suitable for single disk setups.
### Understanding the Image Generation Process