This commit is contained in:
2025-08-12 17:04:25 +00:00
parent 981b41f4c2
commit 5cef58ade0
3 changed files with 603 additions and 55 deletions

View File

@@ -1,4 +1,5 @@
{
config,
lib,
system,
...
@@ -45,6 +46,8 @@ in
ESP = {
priority = 2;
name = "ESP";
# start = "1G";
# end = "2G";
size = "1G";
type = "EF00";
content = {
@@ -54,68 +57,61 @@ in
mountOptions = [ "umask=0077" ];
};
};
root = {
name = "bcachefs-root";
name = "btrfs-root";
size = "100%";
content = {
type = "bcachefs";
filesystem = "main_fs"; # Reference to filesystem below
extraFormatArgs = [ "--discard" ];
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"root" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/root";
};
"nix" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix";
};
"etc" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/etc";
};
"tmp" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/tmp";
};
"log" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/var/log";
};
};
};
};
};
};
};
bcachefs_filesystems = {
main_fs = {
type = "bcachefs_filesystem";
extraFormatArgs = [
"--compression=zstd"
"--background_compression=zstd"
];
subvolumes = {
# Root subvolume
"subvolumes/root" = {
mountpoint = "/root";
mountOptions = [
"noatime"
];
};
# Home subvolume
"subvolumes/home" = {
mountpoint = "/home";
};
# Nix store
"subvolumes/nix" = {
mountpoint = "/nix";
mountOptions = [
"noatime"
];
};
# Etc
"subvolumes/etc" = {
mountpoint = "/etc";
mountOptions = [
"noatime"
];
};
# Tmp
"subvolumes/tmp" = {
mountpoint = "/tmp";
mountOptions = [
"noatime"
];
};
# Log
"subvolumes/log" = {
mountpoint = "/var/log";
mountOptions = [
"noatime"
];
};
};
};
};
};
};
}
}