add supernote syncing

This commit is contained in:
Henri Dohmen 2025-12-30 14:16:33 +01:00
parent 52c074f973
commit 72c6b7ce88
Signed by: hd
GPG key ID: AB79213B044674AE
2 changed files with 28 additions and 10 deletions

View file

@ -11,7 +11,12 @@ let
is-managed = builtins.elem this var.syncthing-managed-clients.managed_clients;
is-server = this == "roam";
devices = lib.attrNames var.syncthing;
devices = [
"roam"
"fw"
];
devices-without-this = lib.remove this devices;
type-encrypt = if is-server then "receiveencrypted" else "sendreceive";
devices-encrypt =
@ -37,6 +42,16 @@ let
params.keep = "10";
};
};
supernote-note = rec {
id = "supernote-note";
path = if is-server then "/data/sync/${id}" else "/home/hd/Documents/Supernote/Notizen";
type = "sendreceive";
devices = devices-without-this ++ [ "supernote" ];
versioning = {
type = "simple";
params.keep = "10";
};
};
};
in
{
@ -54,12 +69,15 @@ in
group = config.services.syncthing.group;
};
services.syncthing = lib.mkIf cfg.enable {
inherit folders;
settings = {
devices = var.syncthing;
};
key = lib.optionalAttrs is-managed config.age.secrets.syncthing-key.path;
cert = lib.optionalAttrs is-managed "${../pki/syncthing + "/${this}.cert"}";
};
services.syncthing = lib.mkIf cfg.enable (
assert lib.assertMsg (builtins.elem this devices) "${this} is not in devices in mod/syncthing.nix";
{
inherit folders;
settings = {
devices = var.syncthing;
};
key = lib.optionalAttrs is-managed config.age.secrets.syncthing-key.path;
cert = lib.optionalAttrs is-managed "${../pki/syncthing + "/${this}.cert"}";
}
);
}

View file

@ -2,7 +2,7 @@
let
inherit (var.syncthing-managed-clients) managed_clients hashes;
unmanaged = {
# "roam".id = "OIKOKOT-LY4JWPX-T7OXE4D-I4ZC3IR-ZLMKFCO-IXSVEYZ-Y3FZOUB-LIG2XAO";
"supernote".id = "3LHXAND-FXDIDWR-7BYAIX4-3GW2BWY-IHTX7HH-LTEDI5T-W7ETGVC-BUP2NAF";
};
in
assert (