refactor: switch from using UUIDs for filesystems to partlabels. Requires partition modifications on hosts before rebuild

This commit is contained in:
2026-10-22 11:13:06 -04:00
parent 685c709937
commit ba69916e0e
5 changed files with 96 additions and 103 deletions
+16 -46
View File
@@ -9,6 +9,7 @@
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
../shared/fs-layouts/single-disk-btrfs.nix
]; ];
boot = { boot = {
@@ -22,58 +23,27 @@
]; ];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-amd" ]; kernelModules = [ ];
extraModulePackages = [ ]; extraModulePackages = [ ];
}; };
fileSystems = { fileSystems."/mnt/fileshare" = {
"/" = { device = "frank@vergil.cfl.rr.com:/mnt/shares";
device = "/dev/disk/by-uuid/7559f03a-28da-482d-934a-5d4f88ab085f"; fsType = "sshfs";
fsType = "btrfs";
};
"/home" = { options = [
device = "/dev/disk/by-uuid/7559f03a-28da-482d-934a-5d4f88ab085f"; "uid=1000"
fsType = "btrfs"; "gid=1000"
options = [ "subvol=home" ]; "default_permissions"
}; "allow_other"
"_netdev"
"/nix" = { "x-systemd.automount"
device = "/dev/disk/by-uuid/7559f03a-28da-482d-934a-5d4f88ab085f"; "reconnect"
fsType = "btrfs"; "ServerAliveInterval=15"
options = [ "subvol=nix" ]; "IdentityFile=${config.sops.secrets.personal_ssh_key_ed25519.path}"
}; ];
"/boot" = {
device = "/dev/disk/by-uuid/12B3-D345";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
"/mnt/fileshare" = {
device = "frank@vergil.cfl.rr.com:/mnt/shares";
fsType = "sshfs";
options = [
"uid=1000"
"gid=1000"
"default_permissions"
"allow_other"
"_netdev"
"x-systemd.automount"
"reconnect"
"ServerAliveInterval=15"
"IdentityFile=/root/.ssh/id_rsa"
];
};
}; };
swapDevices = [
{ device = "/dev/disk/by-uuid/431e8332-e3d5-400b-93e7-27b9c8dc1dfe"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = { hardware = {
+2 -33
View File
@@ -9,6 +9,7 @@
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
../shared/fs-layouts/single-disk-btrfs.nix
]; ];
boot = { boot = {
@@ -24,43 +25,11 @@
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ ];
extraModulePackages = [ ]; extraModulePackages = [ ];
}; };
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/2b88fa45-f012-4df6-b59c-5b45ee0fc6e8";
fsType = "btrfs";
};
"/home" = {
device = "/dev/disk/by-uuid/2b88fa45-f012-4df6-b59c-5b45ee0fc6e8";
fsType = "btrfs";
options = [ "subvol=home" ];
};
"/nix" = {
device = "/dev/disk/by-uuid/2b88fa45-f012-4df6-b59c-5b45ee0fc6e8";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/679B-3FC0";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/2ef72da1-8c5b-449d-8460-0f5833bd856d"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = { hardware = {
@@ -0,0 +1,36 @@
{ _, ... }:
{
# RECOMMENDED BTRFS SUBVOLUME LAYOUT
# /home
# /home/.snapshots (needed if snapper on home dir to be enabled)
# /srv
# /var/lib/portables
# /var/lib/machines
# /tmp
# /var/tmp
#
# REQUIRED PARTLABELS (can be set in parted or other tools NOT!!! FILESYSTEM LABEL!)
# / - NIXOS
# /boot - ESP
# swap - SWAP
fileSystems = {
"/" = {
device = "/dev/disk/by-partlabel/NIXOS";
fsType = "btrfs";
};
"/boot" = {
device = "/dev/disk/by-partlabel/ESP";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
};
swapDevices = [
{ device = "/dev/disk/by-partlabel/SWAP"; }
];
}
@@ -0,0 +1,27 @@
{ _, ... }:
{
# REQUIRED PARTLABELS (can be set in parted or other tools NOT!!! FILESYSTEM LABEL!)
# / - NIXOS
# /boot - ESP
# swap - SWAP
fileSystems = {
"/" = {
device = "/dev/disk/by-partlabel/NIXOS";
fsType = "xfs";
};
"/boot" = {
device = "/dev/disk/by-partlabel/ESP";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
};
swapDevices = [
{ device = "/dev/disk/by-partlabel/SWAP"; }
];
}
+15 -24
View File
@@ -8,6 +8,7 @@
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
../shared/fs-layouts/single-disk-xfs.nix
]; ];
boot = { boot = {
@@ -25,36 +26,26 @@
kernelModules = [ ]; kernelModules = [ ];
}; };
kernelModules = [ "kvm-intel" ]; kernelModules = [ ];
extraModulePackages = [ ]; extraModulePackages = [ ];
}; };
fileSystems = { # DO NOT mount by partlabel or other value other than UUID.
"/" = { # Disk is a child of a VM disk from PROXMOX and WILL NOT
device = "/dev/disk/by-uuid/05376a0d-18d1-4e7b-8f75-fe052a5636ac"; # be picked up automatically elsewise.
fsType = "xfs"; fileSystems."/mnt" = {
}; device = "/dev/disk/by-uuid/1432aeae-71e9-4f34-97dc-cf0fe74a4e00";
fsType = "xfs";
"/boot" = { options = [
device = "/dev/disk/by-uuid/631D-23D2"; "noauto"
fsType = "vfat"; "x-systemd.automount"
options = [ "x-systemd.after=mount-vm-disk.service"
"fmask=0077" ];
"dmask=0077"
];
};
"/mnt" = {
device = "/dev/disk/by-uuid/1432aeae-71e9-4f34-97dc-cf0fe74a4e00";
fsType = "xfs";
options = [
"noauto"
"x-systemd.automount"
"x-systemd.after=mount-vm-disk.service"
];
};
}; };
# Vergil doesn't have a swap device but ../shared/fs-layouts/single-disk-xfs.nix defines one.
# This shouldn't be an issue at runtime but explicit removal reduces log spam.
swapDevices = [ ]; swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;