mirror of
https://github.com/nix-community/disko.git
synced 2024-11-04 05:44:29 +03:00
docs: standardize code blocks
This commit is contained in:
parent
7d6561fee4
commit
b814f6b555
@ -57,7 +57,7 @@ To access sample configurations for commonly-used disk layouts, refer to the
|
|||||||
|
|
||||||
A simple disko configuration may look like this:
|
A simple disko configuration may look like this:
|
||||||
|
|
||||||
```
|
```nix
|
||||||
{
|
{
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk = {
|
disk = {
|
||||||
@ -95,8 +95,8 @@ If you'd saved this configuration in /tmp/disko-config.nix, and wanted to create
|
|||||||
a disk named /dev/nvme0n1, you would run the following command to partition,
|
a disk named /dev/nvme0n1, you would run the following command to partition,
|
||||||
format and mount the disk.
|
format and mount the disk.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
|
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Related Tools
|
## Related Tools
|
||||||
|
@ -45,8 +45,8 @@ If you use nix flakes support:
|
|||||||
|
|
||||||
First add it to [niv](https://github.com/nmattia/niv):
|
First add it to [niv](https://github.com/nmattia/niv):
|
||||||
|
|
||||||
```console
|
```bash
|
||||||
$ niv add nix-community/disko
|
niv add nix-community/disko
|
||||||
```
|
```
|
||||||
|
|
||||||
Then add the following to your configuration.nix in the `imports` list:
|
Then add the following to your configuration.nix in the `imports` list:
|
||||||
@ -63,9 +63,9 @@ Then add the following to your configuration.nix in the `imports` list:
|
|||||||
|
|
||||||
As root run:
|
As root run:
|
||||||
|
|
||||||
```console
|
```bash
|
||||||
$ nix-channel --add https://github.com/nix-community/disko/archive/master.tar.gz disko
|
nix-channel --add https://github.com/nix-community/disko/archive/master.tar.gz disko
|
||||||
$ nix-channel --update
|
nix-channel --update
|
||||||
```
|
```
|
||||||
|
|
||||||
Then add the following to your configuration.nix in the `imports` list:
|
Then add the following to your configuration.nix in the `imports` list:
|
||||||
|
@ -47,8 +47,8 @@ the NixOS manual. Boot the machine from this USB drive.
|
|||||||
|
|
||||||
Identify the name of your system disk by using the `lsblk` command as follows:
|
Identify the name of your system disk by using the `lsblk` command as follows:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ lsblk
|
lsblk
|
||||||
```
|
```
|
||||||
|
|
||||||
The output from this command will look something like this:
|
The output from this command will look something like this:
|
||||||
@ -73,9 +73,9 @@ from the url you noted above, using the `-o` option to save the file as
|
|||||||
disko-config.nix. Your commands would look like this if you had chosen the
|
disko-config.nix. Your commands would look like this if you had chosen the
|
||||||
hybrid layout:
|
hybrid layout:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
cd /tmp
|
cd /tmp
|
||||||
$ curl https://raw.githubusercontent.com/nix-community/disko/master/example/hybrid.nix -o /tmp/disko-config.nix
|
curl https://raw.githubusercontent.com/nix-community/disko/master/example/hybrid.nix -o /tmp/disko-config.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 5: Adjust the device in the disk configuration
|
### Step 5: Adjust the device in the disk configuration
|
||||||
@ -84,20 +84,20 @@ Inside the disko-config.nix the device needs to point to the correct disk name.
|
|||||||
|
|
||||||
Open the configuration in your favorite editor i.e.:
|
Open the configuration in your favorite editor i.e.:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
nano /tmp/disko-config.nix
|
nano /tmp/disko-config.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `<disk-name>` with the name of your disk obtained in Step 1.
|
Replace `<disk-name>` with the name of your disk obtained in Step 1.
|
||||||
|
|
||||||
```
|
```nix
|
||||||
...
|
# ...
|
||||||
main = {
|
main = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = "<disk-name>";
|
device = "<disk-name>";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
...
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 6: Run disko to partition, format and mount your disks
|
### Step 6: Run disko to partition, format and mount your disks
|
||||||
@ -106,16 +106,15 @@ 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.**
|
**Please note: This will erase any existing data on your disk.**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
|
||||||
```
|
```
|
||||||
$ sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
After the command has run, your file system should have been formatted and
|
After the command has run, your file system should have been formatted and
|
||||||
mounted. You can verify this by running the following command:
|
mounted. You can verify this by running the following command:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ mount | grep /mnt
|
mount | grep /mnt
|
||||||
```
|
```
|
||||||
|
|
||||||
The output should look like this if your disk name is `nvme0n1`.
|
The output should look like this if your disk name is `nvme0n1`.
|
||||||
@ -141,16 +140,16 @@ command to generate an initial `configuration.nix`. You will be supplying the
|
|||||||
file system configuration details from `disko-config.nix`. Your CLI command to
|
file system configuration details from `disko-config.nix`. Your CLI command to
|
||||||
generate the configuration will be:
|
generate the configuration will be:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ nixos-generate-config --no-filesystems --root /mnt
|
nixos-generate-config --no-filesystems --root /mnt
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create the file `configuration.nix` in `/mnt/etc/nixos`.
|
This will create the file `configuration.nix` in `/mnt/etc/nixos`.
|
||||||
|
|
||||||
b) Move the `disko` configuration to /etc/nixos
|
b) Move the `disko` configuration to /etc/nixos
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ mv /tmp/disko-config.nix /mnt/etc/nixos
|
mv /tmp/disko-config.nix /mnt/etc/nixos
|
||||||
```
|
```
|
||||||
|
|
||||||
c) You can now edit `configuration.nix` as per your requirements. This is
|
c) You can now edit `configuration.nix` as per your requirements. This is
|
||||||
@ -168,7 +167,7 @@ module and `disko-config.nix` to the imports section. This section will already
|
|||||||
include the file `./hardware-configuration.nix`, and you can add the new entries
|
include the file `./hardware-configuration.nix`, and you can add the new entries
|
||||||
just below this. This section will now include:
|
just below this. This section will now include:
|
||||||
|
|
||||||
```
|
```nix
|
||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
@ -186,7 +185,7 @@ 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
|
**Note:** Its not necessary to set `boot.loader.grub.device` here, since Disko will
|
||||||
take care of that automatically.
|
take care of that automatically.
|
||||||
|
|
||||||
```
|
```nix
|
||||||
# ...
|
# ...
|
||||||
#boot.loader.systemd-boot.enable = true;
|
#boot.loader.systemd-boot.enable = true;
|
||||||
#boot.loader.efi.canTouchEfiVariables = true;
|
#boot.loader.efi.canTouchEfiVariables = true;
|
||||||
@ -198,7 +197,7 @@ take care of that automatically.
|
|||||||
|
|
||||||
f) Finish the installation and reboot your machine,
|
f) Finish the installation and reboot your machine,
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ nixos-install
|
nixos-install
|
||||||
$ reboot
|
reboot
|
||||||
```
|
```
|
||||||
|
@ -59,8 +59,8 @@ generate disk images:
|
|||||||
2. **Execute the result file:** Execute the generated result file. Running
|
2. **Execute the result file:** Execute the generated result file. Running
|
||||||
`./result --help` will output the available options:
|
`./result --help` will output the available options:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
./result --help
|
$ ./result --help
|
||||||
Usage: $script [options]
|
Usage: $script [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
Loading…
Reference in New Issue
Block a user