-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hosts (latitude-7280): Add disko setup
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
Showing
1 changed file
with
65 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
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; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |