Skip to content

Commit

Permalink
WIP: nixos/syncthing: manage secrets with vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Lassulus committed Jan 7, 2025
1 parent ee3740d commit e027034
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nixos/modules/services/networking/syncthing.nix
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,21 @@ in {

config = mkIf cfg.enable {

vars.generators.syncthing = {
files."cert.pem" = {};
files."key.pem" = {};
files."syncthing.pub".secret = false;
runtimeInputs = [
pkgs.coreutils
pkgs.gnugrep
pkgs.syncthing
];
script = ''
syncthing generate --config "$out"
< "$out"/config.xml grep -oP '(?<=<device id=")[^"]+' | uniq > "$out"/syncthing.pub
'';
};

networking.firewall = mkIf cfg.openDefaultPorts {
allowedTCPPorts = [ 22000 ];
allowedUDPPorts = [ 21027 22000 ];
Expand Down

0 comments on commit e027034

Please sign in to comment.