treewide: dedup disko configuration

This commit is contained in:
Lu Wang 2024-12-24 21:17:36 +08:00
parent 71ed8b5ebb
commit fd97c33c56
Signed by: rebmit
SSH key fingerprint: SHA256:3px8QV1zEerIrEWHaqtH5rR9kjetyRST5EipOPrd+bU
21 changed files with 274 additions and 572 deletions

View file

@ -1,76 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=8G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/disk/by-path/pci-0000:04:00.0-nvme-1";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
cryptroot = {
label = "CRYPTROOT";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings = {
allowDiscards = true;
bypassWorkqueues = true;
crypttabExtraOpts = [
"same-cpu-crypt"
"submit-from-crypt-cpus"
];
# unattended boot via usb
keyFile = "/dev/disk/by-id/usb-aigo_U330_80101016-0:0";
keyFileSize = 512 * 64;
};
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,13 +1,29 @@
{ ... }:
{ profiles, ... }:
{
imports = with profiles; [
system.disko.luks-btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=16G" ];
disk.main.device = "/dev/disk/by-path/pci-0000:04:00.0-nvme-1";
};
boot = {
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
initrd = {
availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
# workaround for https://github.com/nix-community/disko/issues/678
luks.devices.cryptroot = {
keyFile = "/dev/disk/by-id/usb-aigo_U330_80101016-0:0";
keyFileSize = 512 * 64;
};
};
kernelModules = [ "kvm-amd" ];
loader = {
efi.canTouchEfiVariables = false;

View file

@ -1,60 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=2G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
boot = {
type = "EF02";
label = "BOOT";
start = "0";
end = "+1M";
};
root = {
label = "ROOT";
end = "-0";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"boot" = {
mountpoint = "/boot";
mountOptions = [ "compress=zstd" ];
};
"nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
"persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,9 +1,15 @@
{ modulesPath, ... }:
{ modulesPath, profiles, ... }:
{
imports = [
imports = with profiles; [
(modulesPath + "/profiles/qemu-guest.nix")
system.disko.btrfs-bios-compat
];
disko.devices = {
nodev."/".mountOptions = [ "size=2G" ];
disk.main.device = "/dev/vda";
};
boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"

View file

@ -1,73 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=8G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/disk/by-path/pci-0000:04:00.0-nvme-1";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
cryptroot = {
label = "CRYPTROOT";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings = {
allowDiscards = true;
bypassWorkqueues = true;
crypttabExtraOpts = [
"same-cpu-crypt"
"submit-from-crypt-cpus"
];
};
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,5 +1,14 @@
{ lib, ... }:
{ profiles, lib, ... }:
{
imports = with profiles; [
system.disko.luks-btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=8G" ];
disk.main.device = "/dev/disk/by-path/pci-0000:04:00.0-nvme-1";
};
boot = {
initrd.availableKernelModules = [
"nvme"

View file

@ -1,73 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=8G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/disk/by-path/pci-0000:04:00.0-nvme-1";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
cryptroot = {
label = "CRYPTROOT";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings = {
allowDiscards = true;
bypassWorkqueues = true;
crypttabExtraOpts = [
"same-cpu-crypt"
"submit-from-crypt-cpus"
];
};
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,5 +1,14 @@
{ lib, ... }:
{ profiles, lib, ... }:
{
imports = with profiles; [
system.disko.luks-btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=8G" ];
disk.main.device = "/dev/disk/by-path/pci-0000:04:00.0-nvme-1";
};
boot = {
initrd.availableKernelModules = [
"nvme"

View file

@ -1,61 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=1G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
label = "ROOT";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,9 +1,15 @@
{ modulesPath, ... }:
{ modulesPath, profiles, ... }:
{
imports = [
imports = with profiles; [
(modulesPath + "/profiles/qemu-guest.nix")
system.disko.btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=1G" ];
disk.main.device = "/dev/vda";
};
boot = {
loader = {
efi.canTouchEfiVariables = true;

View file

@ -1,61 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=1G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
label = "ROOT";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,9 +1,15 @@
{ modulesPath, ... }:
{ modulesPath, profiles, ... }:
{
imports = [
imports = with profiles; [
(modulesPath + "/profiles/qemu-guest.nix")
system.disko.btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=1G" ];
disk.main.device = "/dev/vda";
};
boot = {
loader = {
efi.canTouchEfiVariables = true;

View file

@ -1,61 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=1G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
label = "ROOT";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,9 +1,15 @@
{ modulesPath, ... }:
{ modulesPath, profiles, ... }:
{
imports = [
imports = with profiles; [
(modulesPath + "/profiles/qemu-guest.nix")
system.disko.btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=1G" ];
disk.main.device = "/dev/vda";
};
boot = {
loader = {
efi.canTouchEfiVariables = true;

View file

@ -1,61 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=1G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
label = "ROOT";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,9 +1,15 @@
{ modulesPath, ... }:
{ modulesPath, profiles, ... }:
{
imports = [
imports = with profiles; [
(modulesPath + "/profiles/qemu-guest.nix")
system.disko.btrfs-common
];
disko.devices = {
nodev."/".mountOptions = [ "size=1G" ];
disk.main.device = "/dev/vda";
};
boot = {
loader = {
efi.canTouchEfiVariables = true;

View file

@ -1,60 +1,4 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=4G"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
boot = {
type = "EF02";
label = "BOOT";
start = "0";
end = "+1M";
};
root = {
label = "ROOT";
end = "-0";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"boot" = {
mountpoint = "/boot";
mountOptions = [ "compress=zstd" ];
};
"nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
"persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
environment.globalPersistence = {
enable = true;
root = "/persist";

View file

@ -1,9 +1,15 @@
{ modulesPath, ... }:
{ modulesPath, profiles, ... }:
{
imports = [
imports = with profiles; [
(modulesPath + "/profiles/qemu-guest.nix")
system.disko.btrfs-bios-compat
];
disko.devices = {
nodev."/".mountOptions = [ "size=4G" ];
disk.main.device = "/dev/sda";
};
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"

View file

@ -0,0 +1,56 @@
{ ... }:
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
type = "EF02";
label = "BOOT";
start = "0";
end = "+1M";
};
root = {
label = "ROOT";
end = "-0";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/boot" = {
mountpoint = "/boot";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
}

View file

@ -0,0 +1,57 @@
{ ... }:
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
label = "ROOT";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
}

View file

@ -0,0 +1,69 @@
{ ... }:
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"mode=755"
"nosuid"
"nodev"
];
};
};
disk = {
main = {
type = "disk";
content = {
type = "gpt";
partitions = {
esp = {
label = "ESP";
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
cryptroot = {
label = "CRYPTROOT";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings = {
allowDiscards = true;
bypassWorkqueues = true;
crypttabExtraOpts = [
"same-cpu-crypt"
"submit-from-crypt-cpus"
];
};
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" ];
};
};
};
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
}