refactor(host/orion): improve fs layout

This commit is contained in:
Price Hiller 2025-01-09 16:48:02 -06:00
parent df18b44c4b
commit bd4ed609c9
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -1,4 +1,7 @@
{ lib, ... }: {
lib ? (import <nixpkgs> { }).lib,
...
}:
let let
root-disk = "/dev/nvme0n1"; root-disk = "/dev/nvme0n1";
persist-dir = "/persist"; persist-dir = "/persist";
@ -38,75 +41,63 @@ in
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
esp = esp = {
let priority = 1;
label = "NixOS-Boot"; size = "512M";
in type = "EF00";
{ content = {
priority = 1; extraArgs = [
size = "512M"; "-n 'NixOS-Boot'"
type = "EF00"; ];
content = { type = "filesystem";
extraArgs = [ format = "vfat";
"-n ${label}" mountpoint = "/boot";
"-F 32" mountOptions = [
]; "umask=0077"
type = "filesystem"; "defaults"
format = "vfat"; ];
mountpoint = "/boot";
mountOptions = [
"umask=0077"
"defaults"
];
};
}; };
root = };
let root = {
label = "NixOS-Primary"; size = "100%";
in content = {
{ type = "luks";
size = "100%"; name = "crypted";
settings = {
allowDiscards = true;
bypassWorkqueues = true;
};
content = { content = {
type = "luks"; type = "btrfs";
name = "crypted"; extraArgs = [
settings = { "-f"
allowDiscards = true; "-L NixOS-Primary"
bypassWorkqueues = true; ];
}; preUnmountHook = ''
content = { btrfs subvolume snapshot -r "root" "root-base"
type = "btrfs"; '';
extraArgs = [ subvolumes = {
"-f" "/root" = {
"--label ${label}" mountpoint = "/";
]; };
postCreateHook = '' "/nix" = {
MOUNT="$(mktemp -d)" mountpoint = "/nix";
mount "/dev/disk/by-label/${label}" "$MOUNT" -o subvol=/ mountOptions = [
trap 'umount $MOUNT; rm -rf $MOUNT' EXIT "compress=zstd"
btrfs subvolume snapshot -r "$MOUNT/root" "$MOUNT/root-base" "noatime"
''; ];
subvolumes = { };
"/root" = { "/persist" = {
mountpoint = "/"; mountpoint = "/persist";
}; mountOptions = [
"/nix" = { "compress=zstd"
mountpoint = "/nix"; "noatime"
mountOptions = [ ];
"compress=zstd"
"noatime"
];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [
"compress=zstd"
"noatime"
];
};
}; };
}; };
}; };
}; };
};
}; };
}; };
}; };