103 lines
2.7 KiB
Nix
103 lines
2.7 KiB
Nix
# Legacy storage configuration for defiant
|
|
# This file manually defines ZFS datasets matching the main branch structure
|
|
# to allow incremental migration to the new storage module.
|
|
#
|
|
# Datasets from main branch:
|
|
# - local/ - ephemeral parent
|
|
# - local/home/leyla - ephemeral user home
|
|
# - local/system/nix - nix store
|
|
# - local/system/root - root filesystem (rolled back on boot)
|
|
# - local/system/sops - sops age key
|
|
# - persist/ - persistent parent
|
|
# - persist/home/leyla - persistent user home
|
|
# - persist/system/jellyfin - jellyfin media
|
|
# - persist/system/qbittorrent - qbittorrent media
|
|
# - persist/system/root - persistent root data
|
|
# - persist/system/var/log - log persistence
|
|
{lib, ...}: {
|
|
# Manually define ZFS datasets matching main's structure
|
|
storage.zfs.datasets = {
|
|
# Ephemeral datasets (local/)
|
|
"local" = {
|
|
type = "zfs_fs";
|
|
mount = null;
|
|
};
|
|
"local/home/leyla" = {
|
|
type = "zfs_fs";
|
|
mount = "/home/leyla";
|
|
snapshot = {
|
|
blankSnapshot = true;
|
|
};
|
|
};
|
|
"local/system/nix" = {
|
|
type = "zfs_fs";
|
|
mount = "/nix";
|
|
atime = "off";
|
|
relatime = "off";
|
|
snapshot = {
|
|
autoSnapshot = false;
|
|
};
|
|
};
|
|
"local/system/root" = {
|
|
type = "zfs_fs";
|
|
mount = "/";
|
|
snapshot = {
|
|
blankSnapshot = true;
|
|
};
|
|
};
|
|
"local/system/sops" = {
|
|
type = "zfs_fs";
|
|
mount = "/persist/sops";
|
|
};
|
|
|
|
# Persistent datasets (persist/)
|
|
"persist" = {
|
|
type = "zfs_fs";
|
|
mount = null;
|
|
};
|
|
"persist/home/leyla" = {
|
|
type = "zfs_fs";
|
|
mount = "/persist/home/leyla";
|
|
snapshot = {
|
|
autoSnapshot = true;
|
|
};
|
|
};
|
|
"persist/system/jellyfin" = {
|
|
type = "zfs_fs";
|
|
mount = "/persist/system/jellyfin";
|
|
atime = "off";
|
|
relatime = "off";
|
|
};
|
|
"persist/system/qbittorrent" = {
|
|
type = "zfs_fs";
|
|
mount = "/persist/system/qbittorrent";
|
|
atime = "off";
|
|
relatime = "off";
|
|
};
|
|
"persist/system/root" = {
|
|
type = "zfs_fs";
|
|
mount = "/persist/system/root";
|
|
snapshot = {
|
|
autoSnapshot = true;
|
|
};
|
|
};
|
|
"persist/system/var/log" = {
|
|
type = "zfs_fs";
|
|
mount = "/persist/system/var/log";
|
|
};
|
|
};
|
|
|
|
# Boot commands to rollback ephemeral root on boot
|
|
boot.initrd.postResumeCommands = lib.mkAfter ''
|
|
zfs rollback -r rpool/local/system/root@blank
|
|
'';
|
|
|
|
# FileSystems needed for boot
|
|
fileSystems = {
|
|
"/".neededForBoot = true;
|
|
"/persist/system/root".neededForBoot = true;
|
|
"/persist/system/var/log".neededForBoot = true;
|
|
"/persist/system/jellyfin".neededForBoot = true;
|
|
"/persist/system/qbittorrent".neededForBoot = true;
|
|
};
|
|
}
|