feat: moved services over to using the new storage datasets

This commit is contained in:
Leyla Becker 2025-11-15 16:37:10 -06:00
parent 757a3892e1
commit c2701ea8f0
23 changed files with 281 additions and 606 deletions

View file

@ -13,45 +13,20 @@ in {
};
};
config = lib.mkIf config.services.syncthing.enable (
lib.mkMerge [
(lib.mkIf config.storage.zfs.enable (lib.mkMerge [
{
# Syncthing needs persistent storage for configuration and data
}
(lib.mkIf (!config.services.syncthing.impermanence.enable) {
# TODO: placeholder to configure a unique dataset for this service
})
(lib.mkIf config.services.syncthing.impermanence.enable {
assertions =
[
{
assertion = config.services.syncthing.configDir == configDir;
message = "syncthing config dir does not match persistence";
}
]
++ lib.attrsets.mapAttrsToList (_: folder: {
assertion = lib.strings.hasPrefix mountDir folder.path;
message = "syncthing folder ${folder.label} is stored at ${folder.path} which not under the persisted path of ${mountDir}";
})
config.services.syncthing.settings.folders;
storage.impermanence.datasets."persist/replicate/system/root" = {
directories = {
"${mountDir}" = {
enable = true;
owner.name = "syncthing";
group.name = "syncthing";
};
"${configDir}" = {
enable = true;
owner.name = "syncthing";
group.name = "syncthing";
};
};
};
})
]))
]
);
config = lib.mkIf config.services.syncthing.enable {
storage.datasets.replicate."system/root" = {
directories = {
"${mountDir}" = lib.mkIf config.services.syncthing.impermanence.enable {
enable = true;
owner.name = "syncthing";
group.name = "syncthing";
};
"${configDir}" = lib.mkIf config.services.syncthing.impermanence.enable {
enable = true;
owner.name = "syncthing";
group.name = "syncthing";
};
};
};
};
}