Skip to content

Commit

Permalink
hosts (latitude-7280): Add disko setup
Browse files Browse the repository at this point in the history
This prepares for using disko for formatting disks. This switches
from ext4 to btrfs in order to more easily adopt impermanence some
time in the future (see #16).

This disko configuration is at this point not imported anywhere.
I first need to boot using a live medium and then format the disk
using this configuration. Only then I can use this as my disk
configuration file.

Part of #15
  • Loading branch information
britter committed Mar 26, 2024
1 parent 20dde1f commit 3fc366c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions hosts/latitude-7280/disko.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Disko configuration for formatting the main disk, see https://github.com/nix-community/disko
# Most of this originates from https://www.youtube.com/watch?v=YPKwkWtK7l0
# and https://github.com/katexochen/nixos/blob/f931172d272faa2e15a08d757edf9a6072527d02/modules/disko/btrfs-luks.nix
{device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: let
btrfsMountOpts = ["compress=zstd" "noatime"];
in {
disko.devices = {
disk.main = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
esp = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["default"];
};
};
swap = {
size = "8G";
content = {
type = "swap";
resumeDevice = true;
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = ["--allow-discards"];
askPassword = true;
content = {
type = "btrfs";
extraArgs = ["-f"];
askPassword = true;
content = {
subvolumes = {
"@" = {
mountpoint = "/";
mountOptions = btrfsMountOpts;
};
"@nix" = {
mountpoint = "/nix";
mountOptions = btrfsMountOpts;
};
"@persist" = {
mountpoint = "/persist";
mountOptions = btrfsMountOpts;
};
};
};
};
};
};
};
};
};
};
}

0 comments on commit 3fc366c

Please sign in to comment.