feat: refined options for datasets
This commit is contained in:
parent
0de97fa4a2
commit
9df29cc07f
6 changed files with 295 additions and 271 deletions
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
util,
|
||||
...
|
||||
}: {
|
||||
# TODO: create all of the datasets from option and home-manager datasets
|
||||
|
|
@ -13,50 +12,49 @@
|
|||
storage.zfs.datasets = {
|
||||
"persist/system/nix" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/nix";
|
||||
options = {
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
canmount = "on";
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
mount = {
|
||||
enable = true;
|
||||
mountPoint = "/nix";
|
||||
};
|
||||
snapshot = {
|
||||
autoSnapshot = false;
|
||||
};
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
};
|
||||
"persist/system/var/log" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/var/log";
|
||||
options = {
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
mount = {
|
||||
enable = true;
|
||||
mountPoint = "/var/log";
|
||||
};
|
||||
snapshot = {
|
||||
autoSnapshot = false;
|
||||
};
|
||||
};
|
||||
"persist/system/root" = {
|
||||
type = "zfs_fs";
|
||||
mount = {
|
||||
enable = true;
|
||||
mountPoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
(util.mkUnless config.storage.impermanence.enable {
|
||||
(lib.mkIf (!config.storage.impermanence.enable) {
|
||||
# TODO: create datasets for systemd.services.<name>.storage.impermanence.datasets
|
||||
storage.zfs.datasets = {
|
||||
"persist/system/root" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/";
|
||||
canmount = "on";
|
||||
snapshot = {
|
||||
autoSnapshot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
(lib.mkIf config.storage.impermanence.enable {
|
||||
storage.impermanence.datasets = {
|
||||
"persist/system/root" = {
|
||||
type = "zfs_fs";
|
||||
};
|
||||
};
|
||||
storage.zfs.datasets = {
|
||||
"local/system/root" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/";
|
||||
options = {
|
||||
canmount = "on";
|
||||
};
|
||||
postCreateHook = ''
|
||||
zfs snapshot rpool/local/system/root@blank
|
||||
'';
|
||||
|
||||
directories = {
|
||||
"/var/lib/nixos".enable = true;
|
||||
"/var/lib/systemd/coredump".enable = true;
|
||||
|
|
@ -66,6 +64,18 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
storage.zfs.datasets = {
|
||||
"local/system/root" = {
|
||||
type = "zfs_fs";
|
||||
mount = {
|
||||
enable = true;
|
||||
mountPoint = "/";
|
||||
};
|
||||
snapshot = {
|
||||
blankSnapshot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: home-manager.users.<user>.storage.impermanence.enable
|
||||
# is false then persist the entire directory of the user
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue