98 lines
2.6 KiB
Nix
98 lines
2.6 KiB
Nix
{ disko, config, ... }:
|
|
{
|
|
imports = [ disko.nixosModules.disko ];
|
|
|
|
disko.devices = {
|
|
disk = {
|
|
"${config.networking.hostName}" = {
|
|
type = "disk";
|
|
device = "/dev/nvme0n1";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
ESP = {
|
|
priority = 1;
|
|
size = "2G";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
mountOptions = [ "umask=0077" ];
|
|
};
|
|
};
|
|
luks = {
|
|
size = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "${config.networking.hostName}-disk";
|
|
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 = "/";
|
|
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
|
};
|
|
"/prev" = {
|
|
mountpoint = "/prev";
|
|
mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ];
|
|
};
|
|
"/nix" = {
|
|
mountpoint = "/nix";
|
|
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
|
};
|
|
|
|
# Impermanence
|
|
"/persist" = {
|
|
mountpoint = "/persist";
|
|
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
|
};
|
|
"/persist/.snapshots" = { };
|
|
|
|
"/jimbo" = {
|
|
mountpoint = "/persist/home/jimbo";
|
|
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
|
|
};
|
|
"/jimbo/.snapshots" = { };
|
|
};
|
|
};
|
|
};
|
|
swap = {
|
|
size = "8G";
|
|
content = {
|
|
type = "swap";
|
|
discardPolicy = "both";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
# Needed for impermanence
|
|
fileSystems = {
|
|
"/persist".neededForBoot = true;
|
|
"/persist/home/jimbo".neededForBoot = true;
|
|
};
|
|
}
|