2023-09-28 17:15:12 +00:00
|
|
|
{ config, disk ? "/dev/nvme0n1", ... }:
|
2023-09-25 18:05:07 +00:00
|
|
|
let
|
2023-09-28 15:28:32 +00:00
|
|
|
hostname = config.networking.hostName;
|
2023-09-25 18:05:07 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
2023-09-28 15:28:32 +00:00
|
|
|
nvme = {
|
2023-09-25 18:05:07 +00:00
|
|
|
type = "disk";
|
2023-09-28 17:15:12 +00:00
|
|
|
device = disk;
|
2023-09-25 18:05:07 +00:00
|
|
|
content = {
|
2023-09-28 15:28:32 +00:00
|
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
|
|
ESP = {
|
|
|
|
size = "512M";
|
|
|
|
type = "EF00";
|
2023-09-25 18:05:07 +00:00
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
2023-09-28 15:28:32 +00:00
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
mountOptions = [ "defaults" ];
|
2023-09-25 18:05:07 +00:00
|
|
|
};
|
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 = {
|
|
|
|
"/root" = {
|
|
|
|
mountpoint = "/";
|
|
|
|
mountOptions = [ "compress=zstd" ];
|
|
|
|
};
|
|
|
|
"/home" = {
|
|
|
|
mountpoint = "/home";
|
|
|
|
mountOptions = [ "compress=zstd" ];
|
|
|
|
};
|
|
|
|
"/nix" = {
|
|
|
|
mountpoint = "/nix";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
};
|
|
|
|
"/persist" = {
|
|
|
|
mountpoint = "/persist";
|
|
|
|
mountOptions = [ "compress=zstd" ];
|
|
|
|
};
|
|
|
|
"/var/logs" = {
|
|
|
|
mountpoint = "/var/logs";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-25 18:05:07 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-28 15:28:32 +00:00
|
|
|
|
2023-09-28 17:15:12 +00:00
|
|
|
fileSystems."/persist".neededForBoot = true;
|
|
|
|
}
|