refactor(host/orion): improve fs layout
This commit is contained in:
parent
df18b44c4b
commit
bd4ed609c9
@ -1,4 +1,7 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
lib ? (import <nixpkgs> { }).lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
root-disk = "/dev/nvme0n1";
|
||||
persist-dir = "/persist";
|
||||
@ -38,18 +41,13 @@ in
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
esp =
|
||||
let
|
||||
label = "NixOS-Boot";
|
||||
in
|
||||
{
|
||||
esp = {
|
||||
priority = 1;
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
extraArgs = [
|
||||
"-n ${label}"
|
||||
"-F 32"
|
||||
"-n 'NixOS-Boot'"
|
||||
];
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
@ -60,11 +58,7 @@ in
|
||||
];
|
||||
};
|
||||
};
|
||||
root =
|
||||
let
|
||||
label = "NixOS-Primary";
|
||||
in
|
||||
{
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
@ -77,13 +71,10 @@ in
|
||||
type = "btrfs";
|
||||
extraArgs = [
|
||||
"-f"
|
||||
"--label ${label}"
|
||||
"-L NixOS-Primary"
|
||||
];
|
||||
postCreateHook = ''
|
||||
MOUNT="$(mktemp -d)"
|
||||
mount "/dev/disk/by-label/${label}" "$MOUNT" -o subvol=/
|
||||
trap 'umount $MOUNT; rm -rf $MOUNT' EXIT
|
||||
btrfs subvolume snapshot -r "$MOUNT/root" "$MOUNT/root-base"
|
||||
preUnmountHook = ''
|
||||
btrfs subvolume snapshot -r "root" "root-base"
|
||||
'';
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user