X-Git-Url: http://git.scottworley.com/syncthing-autoregister/blobdiff_plain/64eaba73071fd33f2c824b9d5bc38f3a113eeb90..refs/heads/master:/modules/syncthing-autoregister.nix?ds=inline diff --git a/modules/syncthing-autoregister.nix b/modules/syncthing-autoregister.nix index da9df86..710c7a4 100644 --- a/modules/syncthing-autoregister.nix +++ b/modules/syncthing-autoregister.nix @@ -20,7 +20,7 @@ in { description = '' Path of nix module file to write our syncthing device id into. It will be written into - services.syncthing.declarative.devices..id. This file + services.syncthing.devices..id. This file can be imported as a NixOS module. We recommend using a separate file just for this purpose. I.e., @@ -45,6 +45,20 @@ in { ExecStart = register-script; }; }; + systemd.services.syncthing-reregister = { + after = [ "syncthing-autoregister.service" ]; + script = '' + ${pkgs.coreutils}/bin/sleep 1 + ${pkgs.systemd}/bin/systemctl restart syncthing-autoregister + ''; + serviceConfig = { + Type = "oneshot"; + }; + }; + systemd.paths.syncthing-reregister = { + pathConfig.PathChanged = cfg.path; + wantedBy = [ "multi-user.target" ]; + }; }; }