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

98 lines
2.6 KiB
Nix
Raw Normal View History

2024-11-06 11:49:40 -05:00
{ disko, config, ... }:
{
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
"${config.networking.hostName}" = {
type = "disk";
2024-12-10 17:54:39 -05:00
device = "/dev/mmcblk0";
2024-11-06 11:49:40 -05:00
content = {
type = "gpt";
partitions = {
ESP = {
2024-12-10 17:54:39 -05:00
priority = 1;
size = "1500M";
2024-11-06 11:49:40 -05:00
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
2024-12-10 17:54:39 -05:00
mountOptions = [ "umask=0077" ];
2024-11-06 11:49:40 -05:00
};
};
luks = {
size = "100%";
content = {
type = "luks";
2024-12-10 17:54:39 -05:00
name = "${config.networking.hostName}-disk";
2024-11-06 11:49:40 -05:00
settings.allowDiscards = true;
passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "${config.networking.hostName}";
};
};
};
};
};
};
};
lvm_vg = {
"${config.networking.hostName}" = {
type = "lvm_vg";
lvs = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
2024-12-10 17:54:39 -05:00
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
2024-11-06 11:49:40 -05:00
};
"/prev" = {
mountpoint = "/prev";
2024-12-10 17:54:39 -05:00
mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ];
2024-11-06 11:49:40 -05:00
};
"/nix" = {
mountpoint = "/nix";
2024-12-10 17:54:39 -05:00
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
2024-11-06 11:49:40 -05:00
};
# Impermanence
"/persist" = {
mountpoint = "/persist";
2024-12-10 17:54:39 -05:00
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
2024-11-06 11:49:40 -05:00
};
"/persist/.snapshots" = { };
"/jimbo" = {
mountpoint = "/persist/home/jimbo";
2024-12-10 17:54:39 -05:00
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
2024-11-06 11:49:40 -05:00
};
"/jimbo/.snapshots" = { };
};
};
};
swap = {
2024-12-10 17:54:39 -05:00
size = "1500M";
2024-11-06 11:49:40 -05:00
content = {
type = "swap";
discardPolicy = "both";
};
};
};
};
};
};
# Needed for impermanence
fileSystems = {
"/persist".neededForBoot = true;
"/persist/home/jimbo".neededForBoot = true;
};
}