Files
clan-core/clanServices/syncthing/vars.nix
a-kenji a5e51f658d clanServices: migrate syncthing module to clanServices
Migrate the syncthing module from `clanModules` to `clanServices`.
2025-08-05 10:00:01 +02:00

22 lines
546 B
Nix

{ pkgs, ... }:
{
clan.core.vars.generators.syncthing = {
files.key = { };
files.cert = { };
files.api = { };
files.id.secret = false;
runtimeInputs = [
pkgs.coreutils
pkgs.gnugrep
pkgs.syncthing
];
script = ''
syncthing generate --config "$out"
mv "$out"/key.pem "$out"/key
mv "$out"/cert.pem "$out"/cert
cat "$out"/config.xml | grep -oP '(?<=<device id=")[^"]+' | uniq > "$out"/id
cat "$out"/config.xml | grep -oP '<apikey>\K[^<]+' | uniq > "$out"/api
'';
};
}