Disko transition for non encrypted systems

This commit is contained in:
Vice 2025-03-05 05:08:45 -05:00
parent 2bb4ba3d35
commit 04857582cf
3 changed files with 86 additions and 32 deletions

View file

@ -2,6 +2,7 @@
{
imports = [
./boot
./disko
./filesystems
./hardware
./users

View file

@ -0,0 +1,84 @@
{ config, disko, ... }:
{
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" ];
};
};
main = {
size = "100%";
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" = { };
"/persist/home/${config.sysusers.main}" = { };
"/persist/home/${config.sysusers.main}/.snapshots" = { };
};
};
};
swap = {
size = "2G";
content = {
type = "swap";
discardPolicy = "both";
};
};
};
};
};
};
# Needed for impermanence
fileSystems."/persist".neededForBoot = true;
}

View file

@ -1,42 +1,11 @@
{ ... }:
{
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea";
fsType = "btrfs";
options = [ "subvol=root" ];
};
"/prev" = {
device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea";
fsType = "btrfs";
options = [ "subvol=prev" ];
};
"/nix" = {
device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/7C94-8C9A";
fsType = "vfat";
options = [ "umask=0077" ];
};
# Impermanence and subvols
"/persist" = {
device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea";
fsType = "btrfs";
neededForBoot = true;
options = [ "subvol=persist" ];
};
# Misc bulk storage
"/export/Bulk" = {
device = "/dev/disk/by-uuid/ef465845-cc56-4db5-9260-8ae515eb025e";
fsType = "btrfs";
noCheck = true;
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/7e8c773d-c8f4-4dd8-a835-bde78e5b6760"; }
];
}