73 lines
2.3 KiB
Nix
73 lines
2.3 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
util,
|
|
...
|
|
}: {
|
|
# TODO: create all of the datasets from option and home-manager datasets
|
|
# TODO: set up datasets for systemd services that want a dataset created
|
|
config = lib.mkMerge [
|
|
(
|
|
lib.mkIf config.storage.zfs.enable (lib.mkMerge [
|
|
{
|
|
storage.zfs.datasets = {
|
|
"persist/system/nix" = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/nix";
|
|
options = {
|
|
atime = "off";
|
|
relatime = "off";
|
|
canmount = "on";
|
|
"com.sun:auto-snapshot" = "false";
|
|
};
|
|
};
|
|
"persist/system/var/log" = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/persist/system/var/log";
|
|
options = {
|
|
"com.sun:auto-snapshot" = "false";
|
|
};
|
|
};
|
|
};
|
|
}
|
|
(util.mkUnless config.storage.impermanence.enable {
|
|
# TODO: configure datasets for normal zfs
|
|
# TODO: create datasets for systemd.services.<name>.storage.impermanence.datasets
|
|
storage.zfs.datasets = {
|
|
"persist/system/root" = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/";
|
|
canmount = "on";
|
|
};
|
|
};
|
|
})
|
|
(lib.mkIf config.storage.impermanence.enable {
|
|
storage.impermanence.datasets = {
|
|
"persist/system/root" = {
|
|
type = "zfs_fs";
|
|
};
|
|
};
|
|
storage.zfs.datasets = {
|
|
# TODO: is there a way that we can link these two folders in configs via storage.impermanence.datasets
|
|
"local/system/root" = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/";
|
|
options = {
|
|
canmount = "on";
|
|
};
|
|
postCreateHook = ''
|
|
zfs snapshot rpool/local/system/root@blank
|
|
'';
|
|
};
|
|
};
|
|
|
|
# TODO: home-manager.users.<user>.storage.impermanence.enable
|
|
# is false then persist the entire directory of the user
|
|
# if true persist home-manager.users.<user>.storage.impermanence.datasets
|
|
# TODO: systemd.services.<name>.storage.datasets persists
|
|
})
|
|
])
|
|
)
|
|
# TODO: configure other needed storage modes here
|
|
];
|
|
}
|