]> git.scottworley.com Git - syncthing-autoregister/blobdiff - modules/syncthing-autoregister.nix
Verify files sync after "nixos-rebuild switch"
[syncthing-autoregister] / modules / syncthing-autoregister.nix
index da9df86d1f41e59293af54d9fb525069204ae0ca..ad710f66e6ba450c4fb71e0ec419052f65c45a5e 100644 (file)
@@ -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" ];
+    };
   };
 }