nix-config/nixos/floki/disks.nix

69 lines
2 KiB
Nix
Raw Normal View History

2023-09-28 20:50:54 +00:00
{ config, disk ? "/dev/nvme0n1", ... }:
let
hostname = config.networking.hostName;
in
{
disko.devices = {
disk = {
2023-09-28 15:28:32 +00:00
nvme = {
type = "disk";
2023-09-28 17:15:12 +00:00
device = disk;
content = {
2023-09-28 15:28:32 +00:00
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
2023-09-28 15:28:32 +00:00
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "defaults" ];
};
2023-09-28 15:28:32 +00:00
};
luks = {
size = "100%";
content = {
type = "luks";
name = "${hostname}_crypt";
extraOpenArgs = [ "--allow-discards" ];
# This file contains the key for interactive login which must be
# the secret without a trailing newline.
passwordFile = config.sops.secrets.luks-password.path;
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
2023-09-28 19:29:12 +00:00
"root" = {
2023-09-28 15:28:32 +00:00
mountpoint = "/";
mountOptions = [ "compress=zstd" ];
};
2023-09-28 19:29:12 +00:00
"home" = {
2023-09-28 15:28:32 +00:00
mountpoint = "/home";
mountOptions = [ "compress=zstd" ];
};
2023-09-28 19:29:12 +00:00
"nix" = {
2023-09-28 15:28:32 +00:00
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
2023-09-28 19:29:12 +00:00
"persist" = {
2023-09-28 15:28:32 +00:00
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
2023-09-28 20:50:54 +00:00
"var/logs" = {
2023-09-28 15:28:32 +00:00
mountpoint = "/var/logs";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
};
};
};
};
};
};
};
2023-09-28 15:28:32 +00:00
2023-09-28 17:15:12 +00:00
fileSystems."/persist".neededForBoot = true;
}