1
0
Fork 0

Compare commits

..

No commits in common. "01b4e6eacf344e24b24d8898eda983d88a35a023" and "73c9338b887873c26d5dd0796e317710c39f785f" have entirely different histories.

3 changed files with 36 additions and 54 deletions

View file

@ -7,8 +7,7 @@
}: }:
let let
luksUUID = "9fdc521b-a037-4070-af47-f54da03675e4"; # The UUID of the locked LUKS partition. luksUUID = "9fdc521b-a037-4070-af47-f54da03675e4";
rootUUID = "dfb4fc8f-e82b-43a1-91c1-a77acb6337cb"; # The UUID of the unlocked filesystem partition.
in in
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@ -36,7 +35,7 @@ in
enable = true; enable = true;
devices = { devices = {
boot = "/dev/disk/by-uuid/FC20-D155"; boot = "/dev/disk/by-uuid/FC20-D155";
btrfs = "/dev/disk/by-uuid/${rootUUID}"; btrfs = "/dev/disk/by-uuid/${luksUUID}";
}; };
swapFile = { swapFile = {
enable = true; enable = true;

View file

@ -6,10 +6,6 @@
modulesPath, modulesPath,
... ...
}: }:
let
luksUUID = "bcf67e34-339e-40b9-8ffd-bec8f7f55248"; # The UUID of the locked LUKS partition.
rootUUID = "b801fbea-4cb5-4255-bea9-a2ce77d1a1b7"; # The UUID of the unlocked filesystem partition.
in
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@ -28,8 +24,8 @@ in
"sd_mod" "sd_mod"
"rtsx_pci_sdmmc" "rtsx_pci_sdmmc"
]; ];
luks.devices."luks-${luksUUID}" = { luks.devices."luks-bcf67e34-339e-40b9-8ffd-bec8f7f55248" = {
device = "/dev/disk/by-uuid/${luksUUID}"; device = "/dev/disk/by-uuid/bcf67e34-339e-40b9-8ffd-bec8f7f55248";
crypttabExtraOpts = [ "tpm2-device=auto" ]; # Enable TPM auto-unlocking crypttabExtraOpts = [ "tpm2-device=auto" ]; # Enable TPM auto-unlocking
}; };
}; };
@ -37,16 +33,25 @@ in
kernelModules = [ "kvm-amd" ]; kernelModules = [ "kvm-amd" ];
}; };
# Configure the main filesystem. fileSystems = {
aux.system.filesystem.btrfs = { "/" = {
enable = true; device = "/dev/disk/by-uuid/b801fbea-4cb5-4255-bea9-a2ce77d1a1b7";
devices = { fsType = "btrfs";
boot = "/dev/disk/by-uuid/FC20-D155"; options = [ "subvol=@,compress=zstd,discard" ];
btrfs = "/dev/disk/by-uuid/${rootUUID}";
}; };
swapFile = { "/home" = {
enable = true; device = "/dev/disk/by-uuid/b801fbea-4cb5-4255-bea9-a2ce77d1a1b7";
size = 16384; fsType = "btrfs";
options = [ "subvol=@home,compress=zstd,discard" ];
};
"/swap" = {
device = "/dev/disk/by-uuid/b801fbea-4cb5-4255-bea9-a2ce77d1a1b7";
fsType = "btrfs";
options = [ "subvol=@swap" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/AFCB-D880";
fsType = "vfat";
}; };
}; };

View file

@ -2,7 +2,11 @@
let let
cfg = config.aux.system.filesystem.btrfs; cfg = config.aux.system.filesystem.btrfs;
standardMountOpts = [ "compress=zstd" ]; standardMountOpts = [
"compress=zstd"
"discard=async"
"noatime"
];
in in
{ {
options = { options = {
@ -20,16 +24,6 @@ in
default = ""; default = "";
}; };
}; };
subvolumes = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Which subvolumes to mount. Leave as the default to create all standard subvolumes.";
default = [
"/"
"/home"
"/nix"
"/var/log"
];
};
swapFile = { swapFile = {
enable = lib.mkEnableOption (lib.mdDoc "Enables the creation of a swap file."); enable = lib.mkEnableOption (lib.mdDoc "Enables the creation of a swap file.");
size = lib.mkOption { size = lib.mkOption {
@ -56,52 +50,36 @@ in
]; ];
fileSystems = fileSystems =
{ {
"/" = lib.mkIf (builtins.elem "/" cfg.subvolumes) { "/" = {
device = cfg.devices.btrfs; device = cfg.devices.btrfs;
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [ "subvol=@" ] ++ standardMountOpts;
"subvol=@"
"compress=zstd"
];
}; };
"/boot" = { "/boot" = {
device = cfg.devices.boot; device = cfg.devices.boot;
fsType = "vfat"; fsType = "vfat";
}; };
"/home" = lib.mkIf (builtins.elem "/home" cfg.subvolumes) { "/home" = {
device = cfg.devices.btrfs; device = cfg.devices.btrfs;
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [ "subvol=@home" ] ++ standardMountOpts;
"subvol=@home"
"compress=zstd"
];
}; };
"/var/log" = lib.mkIf (builtins.elem "/var/log" cfg.subvolumes) { "/var/log" = {
device = cfg.devices.btrfs; device = cfg.devices.btrfs;
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [ "subvol=@log" ] ++ standardMountOpts;
"subvol=@log"
"compress=zstd"
];
}; };
"/nix" = lib.mkIf (builtins.elem "/nix" cfg.subvolumes) { "/nix" = {
device = cfg.devices.btrfs; device = cfg.devices.btrfs;
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [ "subvol=@nix" ] ++ standardMountOpts;
"subvol=@nix"
"compress=zstd"
"noatime"
];
}; };
} }
// lib.optionalAttrs cfg.swapFile.enable { // lib.optionalAttrs cfg.swapFile.enable {
"/swap" = { "/swap" = {
device = cfg.devices.btrfs; device = cfg.devices.btrfs;
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [ "subvol=@swap" ];
"subvol=@swap"
"noatime"
];
}; };
}; };