generated from brckd/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(disk-partitioning): document disko setup
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
title: Disk Partitioning | ||
description: Learn how to automate drive partitioning with disko. | ||
--- | ||
|
||
import { Aside, Steps, Tabs, TabItem } from "@astrojs/starlight/components"; | ||
|
||
<Aside> | ||
This guide assumes that you have [set up your NixOS environment](set-up-nix), | ||
which includes enabling flakes and entering the Git repository. The disko | ||
setup has to be performed before installing the NixOS system however. | ||
</Aside> | ||
|
||
When reinstalling NixOS from an existing configuration, the only manual step is often disk partitioning. But even this step can be automated using disko. | ||
|
||
## Setup | ||
|
||
To create a new disko configuration, copy one of the existing disko configurations into `configs/nixos/$(hostname)/disko.nix`. | ||
|
||
<Steps> | ||
<ol> | ||
<li> | ||
|
||
Copy an existing disko configuration into the host's configuration directory. | ||
|
||
<Tabs syncKey="nix-environment"> | ||
<TabItem label="NixOS"> | ||
|
||
```zsh | ||
cp configs/nixos/desktop/disko.nix configs/nixos/$(hostname) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
</li> | ||
<li> | ||
|
||
Edit the disk layout according to your needs. Replace `disko.devices.disk.main.device` with the name listed by `lsblk` for your main drive. | ||
|
||
<Tabs syncKey="nix-environment"> | ||
<TabItem label="NixOS"> | ||
|
||
```zsh | ||
sudo lsblk | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
</li> | ||
<li> | ||
|
||
Apply the disko configuration. | ||
|
||
<Tabs syncKey="nix-environment"> | ||
<TabItem label="NixOS"> | ||
|
||
```zsh | ||
sudo nix run github:nix-community/disko/latest -- --mode destroy,format,mount configs/nixos/$(hostname)/disko.nix | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
</li> | ||
<li> | ||
|
||
Generate a new hardware configuration excluding the filesystem configurations provided by disko. | ||
|
||
<Tabs syncKey="nix-environment"> | ||
<TabItem label="NixOS"> | ||
|
||
```zsh | ||
sudo nixos-generate-config --no-filesystems --root /mnt --dir configs/nixos/$(hostname) | ||
rm configs/nixos/$(hostname)/{configuration,hardware}.nix | ||
cp configs/nixos/$(hostname)/hardware-configuration.nix configs/nixos/$(hostname)/hardware.nix | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
</li> | ||
</ol> | ||
</Steps> | ||
|
||
## Further reading | ||
|
||
- [disko documentation](https://github.com/nix-community/disko/blob/master/docs/INDEX.md) |