Update disk definitions for all machines using disko

This commit is contained in:
albert 2024-02-20 11:21:16 +09:00
parent c1adb6c4b7
commit 499b62f748
No known key found for this signature in database
GPG key ID: 64F6C4EB46C4543A
6 changed files with 50 additions and 137 deletions

View file

@ -12,26 +12,26 @@
services.btrfs.autoScrub.interval = "weekly"; services.btrfs.autoScrub.interval = "weekly";
disko.devices.disk.nvme0 = { disko.devices.disk.nvme0 = {
type = "disk";
device = "/dev/nvme0n1"; device = "/dev/nvme0n1";
content = { content = {
type = "table";
format = "gpt"; format = "gpt";
partitions = [ partitions = {
{ BOOT = {
priority = 1;
name = "BOOT"; name = "BOOT";
start = "0%"; start = "0%";
end = "550MiB"; end = "550MiB";
bootable = true; type = "EF00";
flags = [ "esp" ];
fs-type = "fat32";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
# https://github.com/nix-community/disko/issues/527
mountOptions = [ "umask=0077" ];
mountpoint = "/boot"; mountpoint = "/boot";
}; };
} # partition 1 (ESP) }; # partition 1 (ESP)
{ LUKS-ROOT = {
name = "LUKS";
start = "550MiB"; start = "550MiB";
end = "100%"; end = "100%";
content = { content = {
@ -78,8 +78,8 @@
}; # subvolumes }; # subvolumes
}; # content.content }; # content.content
}; # content }; # content
} # partition 2 (/ BTRFS) }; # partition 2 (/ BTRFS)
]; # partitions }; # partitions
}; # content }; # content
}; # disko.devices.disk.nvme0 }; # disko.devices.disk.nvme0
} # root } # root

View file

@ -1,30 +1,30 @@
{ {
imports = [ ../../common/services/snapper.nix ]; imports = [ ../../common/services/snapper.nix ];
services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.enable = true;
services.btrfs.autoScrub.interval = "weekly"; services.btrfs.autoScrub.interval = "weekly";
disko.devices.disk.nvme0 = { disko.devices.disk.nvme0 = {
type = "disk";
device = "/dev/nvme0n1"; device = "/dev/nvme0n1";
content = { content = {
type = "table";
format = "gpt"; format = "gpt";
partitions = [ partitions = {
{ BOOT = {
priority = 1;
name = "BOOT"; name = "BOOT";
start = "0%"; start = "0%";
end = "550MiB"; end = "550MiB";
bootable = true; type = "EF00";
flags = [ "esp" ];
fs-type = "fat32";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
# https://github.com/nix-community/disko/issues/527
mountOptions = [ "umask=0077" ];
mountpoint = "/boot"; mountpoint = "/boot";
}; };
} # partition 1 (ESP) }; # partition 1 (ESP)
{ LUKS-ROOT = {
name = "LUKS";
start = "550MiB"; start = "550MiB";
end = "100%"; end = "100%";
content = { content = {
@ -47,10 +47,6 @@
mountpoint = "/nix"; mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ]; mountOptions = [ "compress=zstd" "noatime" ];
}; # nix }; # nix
"/games" = {
mountpoint = "/games";
mountOptions = [ "noatime" ];
}; # games
# SNAPSHOT SUBVOLS # SNAPSHOT SUBVOLS
"/root/.snapshots" = { "/root/.snapshots" = {
mountpoint = "/.snapshots"; mountpoint = "/.snapshots";
@ -67,8 +63,8 @@
}; # subvolumes }; # subvolumes
}; # content.content }; # content.content
}; # content }; # content
} # partition 2 (/ BTRFS) }; # partition 2 (/ BTRFS)
]; # partitions }; # partitions
}; # content }; # content
}; # disko.devices.disk.nvme0 }; # disko.devices.disk.nvme0
} # root } # root

View file

@ -2,7 +2,7 @@
imports = [ imports = [
inputs.nixos-hardware.nixosModules.framework-13-7040-amd inputs.nixos-hardware.nixosModules.framework-13-7040-amd
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
./disks-gpt.nix ./disks.nix
./syncthing.nix ./syncthing.nix
../../common/services/tailscale-autoconnect.nix ../../common/services/tailscale-autoconnect.nix
# ../../common/modules/secureboot.nix # ../../common/modules/secureboot.nix

View file

@ -1,79 +0,0 @@
{
imports = [ ../../common/services/snapper.nix ];
services.btrfs.autoScrub.enable = true;
services.btrfs.autoScrub.interval = "weekly";
boot.resumeDevice = "/dev/mapper/ROOT";
# https://sawyershepherd.org/post/hibernating-to-an-encrypted-swapfile-on-btrfs-with-nixos/
boot.kernelParams = [ "resume_offset=533760" ];
disko.devices.disk.nvme0n1 = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
BOOT = {
priority = 1;
name = "BOOT";
start = "0%";
end = "550MiB";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
# https://github.com/nix-community/disko/issues/527
mountOptions = [ "umask=0077" ];
mountpoint = "/boot";
};
}; # partition 1 (ESP)
LUKS-ROOT = {
start = "550MiB";
end = "100%";
content = {
type = "luks";
name = "ROOT";
extraOpenArgs = [ "--allow-discards" ];
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
}; # root
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" "noatime" ];
}; # home
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
}; # nix
# SNAPSHOT SUBVOLS
"/root/.snapshots" = {
mountpoint = "/.snapshots";
mountOptions = [ "compress=zstd" "noatime" ];
}; # root
"/home/.snapshots" = {
mountpoint = "/home/.snapshots";
mountOptions = [ "compress=zstd" "noatime" ];
}; # home
"/nix/.snapshots" = {
mountpoint = "/nix/.snapshots";
mountOptions = [ "compress=zstd" "noatime" ];
}; # nix
# Swap partition
"/swap" = {
mountpoint = "/swap";
swap.swapfile.size = "64G";
}; # swap
}; # subvolumes
}; # content.content
}; # content
}; # partition 2 (/ BTRFS)
}; # partitions
}; # content
}; # disko.devices.disk.nvme0
} # nix

View file

@ -1,28 +1,25 @@
{ {
imports = [ ../../common/services/snapper.nix ]; imports = [ ../../common/services/snapper.nix ];
services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.enable = true;
services.btrfs.autoScrub.interval = "weekly"; services.btrfs.autoScrub.interval = "weekly";
boot.resumeDevice = "/dev/mapper/ROOT"; boot.resumeDevice = "/dev/mapper/ROOT";
boot.kernelParams = [ "resume_offset=533760" ];
# https://sawyershepherd.org/post/hibernating-to-an-encrypted-swapfile-on-btrfs-with-nixos/ # https://sawyershepherd.org/post/hibernating-to-an-encrypted-swapfile-on-btrfs-with-nixos/
boot.kernelParams = [ "resume_offset=533760" ];
disko.devices.disk.nvme0 = { disko.devices.disk.nvme0n1 = {
type = "disk";
device = "/dev/nvme0n1"; device = "/dev/nvme0n1";
content = { content = {
type = "table"; type = "gpt";
format = "gpt"; partitions = {
partitions = [ BOOT = {
{ priority = 1;
name = "BOOT"; name = "BOOT";
start = "0%"; start = "0%";
end = "550MiB"; end = "550MiB";
bootable = true; type = "EF00";
flags = [ "esp" ];
fs-type = "fat32";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
@ -30,11 +27,10 @@
mountOptions = [ "umask=0077" ]; mountOptions = [ "umask=0077" ];
mountpoint = "/boot"; mountpoint = "/boot";
}; };
} # partition 1 (ESP) }; # partition 1 (ESP)
{ LUKS-ROOT = {
name = "LUKS-ROOT";
start = "550MiB"; start = "550MiB";
end = "-64GiB"; end = "100%";
content = { content = {
type = "luks"; type = "luks";
name = "ROOT"; name = "ROOT";
@ -76,8 +72,8 @@
}; # subvolumes }; # subvolumes
}; # content.content }; # content.content
}; # content }; # content
} # partition 2 (/ BTRFS) }; # partition 2 (/ BTRFS)
]; # partitions }; # partitions
}; # content }; # content
}; # disko.devices.disk.nvme0 }; # disko.devices.disk.nvme0
} # nix } # nix

View file

@ -1,30 +1,30 @@
{ {
imports = [ ../../common/services/snapper.nix ]; imports = [ ../../common/services/snapper.nix ];
services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.enable = true;
services.btrfs.autoScrub.interval = "weekly"; services.btrfs.autoScrub.interval = "weekly";
disko.devices.disk.nvme0 = { disko.devices.disk.nvme0 = {
type = "disk";
device = "/dev/nvme0n1"; device = "/dev/nvme0n1";
content = { content = {
type = "table";
format = "gpt"; format = "gpt";
partitions = [ partitions = {
{ BOOT = {
priority = 1;
name = "BOOT"; name = "BOOT";
start = "0%"; start = "0%";
end = "550MiB"; end = "550MiB";
bootable = true; type = "EF00";
flags = [ "esp" ];
fs-type = "fat32";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
# https://github.com/nix-community/disko/issues/527
mountOptions = [ "umask=0077" ];
mountpoint = "/boot"; mountpoint = "/boot";
}; };
} # partition 1 (ESP) }; # partition 1 (ESP)
{ LUKS-ROOT = {
name = "LUKS";
start = "550MiB"; start = "550MiB";
end = "100%"; end = "100%";
content = { content = {
@ -63,8 +63,8 @@
}; # subvolumes }; # subvolumes
}; # content.content }; # content.content
}; # content }; # content
} # partition 2 (/ BTRFS) }; # partition 2 (/ BTRFS)
]; # partitions }; # partitions
}; # content }; # content
}; # disko.devices.disk.nvme0 }; # disko.devices.disk.nvme0
} # root } # root