NixOS-Config/hosts/redmond/disko/default.nix

97 lines
2.5 KiB
Nix
Raw Permalink Normal View History

2024-11-06 11:49:40 -05:00
{ disko, config, ... }:
{
2024-11-06 11:49:40 -05:00
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
2024-11-06 11:49:40 -05:00
"${config.networking.hostName}" = {
type = "disk";
2024-11-06 11:49:40 -05:00
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0022" "dmask=0022" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
2024-11-06 11:49:40 -05:00
name = "crypt-nvme";
settings.allowDiscards = true;
2024-11-06 11:49:40 -05:00
passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
2024-11-06 11:49:40 -05:00
vg = "${config.networking.hostName}";
};
};
};
};
};
};
};
lvm_vg = {
2024-11-06 11:49:40 -05:00
"${config.networking.hostName}" = {
type = "lvm_vg";
lvs = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
2024-11-06 11:49:40 -05:00
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
2024-11-06 11:49:40 -05:00
"/prev" = {
mountpoint = "/prev";
mountOptions = [ "compress=zstd" "noatime" ];
};
2024-11-06 11:49:40 -05:00
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
# Impermanence
2024-11-06 11:49:40 -05:00
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
2024-11-06 11:49:40 -05:00
"/persist/.snapshots" = { };
"/jimbo" = {
mountpoint = "/persist/home/jimbo";
mountOptions = [ "compress=zstd" "noatime" ];
};
2024-11-06 11:49:40 -05:00
"/jimbo/.snapshots" = { };
};
};
};
swap = {
size = "8G";
content = {
type = "swap";
discardPolicy = "both";
};
};
};
};
};
};
# Needed for impermanence
fileSystems = {
"/persist".neededForBoot = true;
"/persist/home/jimbo".neededForBoot = true;
};
}