This commit is contained in:
mjallen18
2025-08-18 20:54:03 -05:00
parent 2623efc997
commit 05affb6b1f
3 changed files with 65 additions and 79 deletions

11
flake.lock generated
View File

@@ -180,16 +180,15 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1742690494, "lastModified": 1755519972,
"narHash": "sha256-SFacEbSRMoTyWG5VXh4ieofJGge+cLq9lH8ifB+zjBg=", "narHash": "sha256-bU4nqi3IpsUZJeyS8Jk85ytlX61i4b0KCxXX9YcOgVc=",
"owner": "nvmd", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "9dc58d4d49c9f74623a06e2fc20cdfd8bb3cbe8b", "rev": "4073ff2f481f9ef3501678ff479ed81402caae6d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nvmd", "owner": "nix-community",
"ref": "gpt-attrs",
"repo": "disko", "repo": "disko",
"type": "github" "type": "github"
} }

View File

@@ -43,8 +43,8 @@
disko = { disko = {
# the fork is needed for partition attributes support # the fork is needed for partition attributes support
url = "github:nvmd/disko/gpt-attrs"; # url = "github:nvmd/disko/gpt-attrs";
# url = "github:nix-community/disko"; url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };

View File

@@ -1,44 +1,35 @@
{ {
config,
lib, lib,
system, system,
namespace,
... ...
}: }:
let let
cfg = config.${namespace}.hardware.disko;
isArm = builtins.match "aarch64*" system != null; isArm = builtins.match "aarch64*" system != null;
rootDisk = "/dev/nvme0n1"; rootDisk = "/dev/nvme0n1";
in in
{ {
imports = [ ../options.nix ]; imports = [ ../options.nix ];
config = lib.mkIf (!isArm) {
config = lib.mkIf (cfg.enable && !isArm) {
disko.devices = { disko.devices = {
nodev."/" = { nodev."/" = {
fsType = "tmpfs"; fsType = "tmpfs";
mountOptions = [ mountOptions = [
"mode=755" "mode=755"
"defaults" "defaults"
"size=25%" "size=2G"
]; ];
}; };
# root disk setup disk = {
disk.main = { main = {
type = "disk";
device = rootDisk; device = rootDisk;
imageSize = "32G"; type = "disk";
imageSize = "15G";
content = { content = {
type = "gpt"; type = "gpt";
# specify partitions
partitions = { partitions = {
# /boot
ESP = { ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "1G";
type = "EF00"; type = "EF00";
size = "100M";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
@@ -48,44 +39,43 @@ in
}; };
root = { root = {
name = "btrfs-root";
size = "100%"; size = "100%";
content = { content = {
type = "btrfs"; type = "bcachefs";
extraArgs = [ "-f" ]; # Override existing partition # This refers to a filesystem in the `bcachefs_filesystems` attrset below.
# Subvolumes must set a mountpoint in order to be mounted, filesystem = "mounted_subvolumes_in_multi";
# unless their parent is mounted label = "ssd.ssd1";
subvolumes = { extraFormatArgs = [
"home" = { "--discard"
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"root" = {
mountOptions = [
"compress=zstd"
"noatime"
]; ];
};
};
};
};
};
};
bcachefs_filesystems = {
mounted_subvolumes_in_multi = {
type = "bcachefs_filesystem";
# passwordFile = "/etc/nixos/pool.jwe";
extraFormatArgs = [
"--compression=zstd"
];
subvolumes = {
"subvolumes/root" = {
mountpoint = "/root"; mountpoint = "/root";
}; };
"nix" = { "subvolumes/home" = {
mountOptions = [ mountpoint = "/home";
"compress=zstd" };
"noatime" "subvolumes/nix" = {
];
mountpoint = "/nix"; mountpoint = "/nix";
}; };
"etc" = { "subvolumes/etc" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/etc"; mountpoint = "/etc";
}; };
"log" = { "subvolumes/log" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/var/log"; mountpoint = "/var/log";
}; };
}; };
@@ -93,7 +83,4 @@ in
}; };
}; };
}; };
};
};
};
} }