storage-refactor #9

Open
jan-leila wants to merge 40 commits from storage-refactor into main
4 changed files with 17 additions and 4 deletions
Showing only changes of commit a4f3b3141d - Show all commits

View file

@ -87,7 +87,10 @@ in {
neededForBoot = true; neededForBoot = true;
} }
) )
config.storage.impermanence.datasets; (lib.filterAttrs (
datasetName: dataset: dataset.impermanence.enable
)
config.storage.impermanence.datasets);
environment.persistence = environment.persistence =
lib.mapAttrs (datasetName: dataset: { lib.mapAttrs (datasetName: dataset: {
@ -116,7 +119,10 @@ in {
in in
(enabledDirectories != {}) || (enabledFiles != {}) (enabledDirectories != {}) || (enabledFiles != {})
) )
config.storage.impermanence.datasets); (lib.filterAttrs (
datasetName: dataset: dataset.impermanence.enable
)
config.storage.impermanence.datasets));
} }
(lib.mkIf config.storage.zfs.enable { (lib.mkIf config.storage.zfs.enable {
storage.zfs.datasets = storage.zfs.datasets =

View file

@ -43,6 +43,7 @@ in {
storage.datasets = { storage.datasets = {
local = { local = {
"nix" = { "nix" = {
impermanence.enable = false;
type = "zfs_fs"; type = "zfs_fs";
mount = "/nix"; mount = "/nix";
snapshot = { snapshot = {
@ -54,6 +55,7 @@ in {
}; };
replicate = { replicate = {
"system/var/log" = { "system/var/log" = {
impermanence.enable = false;
type = "zfs_fs"; type = "zfs_fs";
mount = "/var/log"; mount = "/var/log";
}; };
@ -78,13 +80,13 @@ in {
# TODO: can we auto set the mount points on these to just be `"/persist/local/${name}"` # TODO: can we auto set the mount points on these to just be `"/persist/local/${name}"`
local = { local = {
"" = { "" = {
mount = "/persist/local/"; mount = "/persist/local";
}; };
}; };
# TODO: can we auto set the mount points on these to just be `"/persist/replicate/${name}"` # TODO: can we auto set the mount points on these to just be `"/persist/replicate/${name}"`
replicate = { replicate = {
"" = { "" = {
mount = "/persist/replicate/"; mount = "/persist/replicate";
}; };
"system/root" = { "system/root" = {
mount = "/persist/replicate/system/root"; mount = "/persist/replicate/system/root";

View file

@ -44,6 +44,10 @@ in {
type = lib.types.attrsOf (lib.types.submodule pathTypeSubmodule); type = lib.types.attrsOf (lib.types.submodule pathTypeSubmodule);
default = {}; default = {};
}; };
impermanence.enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
}; };
config = { config = {

View file

@ -407,6 +407,7 @@ in {
mount = SOPS_AGE_KEY_DIRECTORY; mount = SOPS_AGE_KEY_DIRECTORY;
atime = "off"; atime = "off";
relatime = "off"; relatime = "off";
impermanence.enable = false;
}; };
} }
(lib.mkIf (!config.storage.impermanence.enable) { (lib.mkIf (!config.storage.impermanence.enable) {