]> git.scottworley.com Git - syncthing-autoregister/blobdiff - modules/syncthing-autoregister.nix
Follow nix version bump that changed the eval command line interface
[syncthing-autoregister] / modules / syncthing-autoregister.nix
index 6276352f67b558773e4349017f694e151e0aa20d..ad710f66e6ba450c4fb71e0ec419052f65c45a5e 100644 (file)
@@ -17,7 +17,6 @@ in {
       '';
       path = mkOption {
         type = types.path;
-        default = "/tmp/syncthing-auto-register-test-device-ids.nix";
         description = ''
           Path of nix module file to write our syncthing
           device id into.  It will be written into
@@ -46,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" ];
+    };
   };
 }