fix(hosts): use stable disk identifiers

Assisted-by: pi (gpt-5.6-sol)
This commit is contained in:
Gabriel Fontes
2026-08-24 10:54:18 -03:00
parent 6ccca4efdf
commit d61d8dd7c4
5 changed files with 62 additions and 46 deletions
+38 -36
View File
@@ -17,54 +17,56 @@
loader.grub = {
enable = true;
version = 2;
device = "/dev/vda";
device = "/dev/disk/by-path/virtio-pci-0000:00:05.0";
};
};
disko.devices.disk.main = {
device = "/dev/vda";
device = "/dev/disk/by-path/virtio-pci-0000:00:05.0";
type = "disk";
# TODO: switch to gpt when reinstalling alcyone, eventually.
content = {
type = "table";
format = "msdos";
partitions = [{
content = {
type = "btrfs";
postCreateHook = ''
MNTPOINT=$(mktemp -d)
mount -t btrfs "$device" "$MNTPOINT"
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
'';
subvolumes = {
"/boot" = {
mountOptions = [];
mountpoint = "/boot";
};
"/root" = {
mountOptions = ["compress=zstd"];
mountpoint = "/";
};
"/nix" = {
mountOptions = ["noatime" "compress=zstd"];
mountpoint = "/nix";
};
"/persist" = {
mountOptions = ["compress=zstd"];
mountpoint = "/persist";
};
"/swap" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/swap";
swap.swapfile = {
size = "3072M";
path = "swapfile";
partitions = [
{
content = {
type = "btrfs";
postCreateHook = ''
MNTPOINT=$(mktemp -d)
mount -t btrfs "$device" "$MNTPOINT"
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
'';
subvolumes = {
"/boot" = {
mountOptions = [];
mountpoint = "/boot";
};
"/root" = {
mountOptions = ["compress=zstd"];
mountpoint = "/";
};
"/nix" = {
mountOptions = ["noatime" "compress=zstd"];
mountpoint = "/nix";
};
"/persist" = {
mountOptions = ["compress=zstd"];
mountpoint = "/persist";
};
"/swap" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/swap";
swap.swapfile = {
size = "3072M";
path = "swapfile";
};
};
};
};
};
}];
}
];
};
};
+1 -1
View File
@@ -34,7 +34,7 @@
};
disko.devices.disk.main = {
device = "/dev/nvme0n1";
device = "/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b448b49b89174";
type = "disk";
content = {
type = "gpt";
@@ -1,4 +1,8 @@
{inputs, modulesPath, ...}: {
{
inputs,
modulesPath,
...
}: {
imports = [
../common/optional/ephemeral-btrfs.nix
(modulesPath + "/profiles/qemu-guest.nix")
@@ -30,7 +34,7 @@
};
disko.devices.disk.main = {
device = "/dev/vda";
device = "/dev/disk/by-id/wwn-0x60352ec0420046b8b663e821c315f803";
type = "disk";
content = {
type = "gpt";
+11 -5
View File
@@ -1,4 +1,10 @@
{inputs, config, pkgs, lib, ...}: {
{
inputs,
config,
pkgs,
lib,
...
}: {
imports = [
../common/optional/ephemeral-btrfs.nix
inputs.disko.nixosModules.disko
@@ -13,7 +19,7 @@
disko.devices.disk = {
main = {
device = "/dev/sdb";
device = "/dev/disk/by-id/usb-Argon_Forty_000000000F38-0:0";
type = "disk";
content = {
type = "gpt";
@@ -64,7 +70,7 @@
};
};
sd-card = {
device = "/dev/mmcblk0";
device = "/dev/disk/by-id/mmc-SS32G_0x95aa1789";
type = "disk";
content = {
type = "gpt";
@@ -79,7 +85,7 @@
};
};
hdd = {
device = "/dev/sda";
device = "/dev/disk/by-id/wwn-0x50014ee2c1c1deaa";
type = "disk";
content = {
type = "gpt";
@@ -98,7 +104,7 @@
};
};
hdd2 = {
device = "/dev/sdc";
device = "/dev/disk/by-id/wwn-0x5000c50090d3963f";
type = "disk";
content = {
type = "gpt";
@@ -1,4 +1,8 @@
{modulesPath, inputs, ...}: {
{
modulesPath,
inputs,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
inputs.disko.nixosModules.disko
@@ -17,7 +21,7 @@
};
disko.devices.disk.main = {
device = "/dev/vda";
device = "/dev/disk/by-path/virtio-pci-0000:00:04.0";
type = "disk";
content = {
type = "gpt";