32 lines
827 B
Nix
32 lines
827 B
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
mountDir = "/mnt/sync";
|
|
configDir = "/etc/syncthing";
|
|
in {
|
|
options = {
|
|
services.syncthing.impermanence.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = config.services.syncthing.enable && config.storage.impermanence.enable;
|
|
};
|
|
};
|
|
|
|
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";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|