about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-21 18:00:30 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-21 18:00:30 -0700
commit0a7cb08c4bf45682b98b6fa443612c20eb3c64ae (patch)
treec0bddf791c64776efc9e7e5e160da775e9100874
parentsyncthing: let's run it from home-manager (diff)
downloadworld-0a7cb08c4bf45682b98b6fa443612c20eb3c64ae.tar.gz
syncthing: enable on tahoe
-rw-r--r--home/syncthing/default.nix14
-rw-r--r--hosts/tahoe/services.nix1
-rw-r--r--modules/services/syncthing/default.nix18
3 files changed, 13 insertions, 20 deletions
diff --git a/home/syncthing/default.nix b/home/syncthing/default.nix
deleted file mode 100644
index 4e8e4f3..0000000
--- a/home/syncthing/default.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{ lib, config, pkgs, ... }:
-let cfg = config.my.home.syncthing;
-in {
-  options.my.home.syncthing = with lib; {
-    enable = mkEnableOption "syncthing configuration";
-  };
-
-  config.home = {
-    services.syncthing = {
-      enable = true;
-      openDefaultPorts = true;
-    };
-  };
-}
diff --git a/hosts/tahoe/services.nix b/hosts/tahoe/services.nix
index b1ed33f..7de94f6 100644
--- a/hosts/tahoe/services.nix
+++ b/hosts/tahoe/services.nix
@@ -37,6 +37,7 @@ in {
       vhostName = "bt.fcuny.xyz";
     };
     metrics-exporter = { enable = true; };
+    syncthing.enable = true;
     backup = {
       enable = true;
       repository = "/data/slow/backups/systems";
diff --git a/modules/services/syncthing/default.nix b/modules/services/syncthing/default.nix
index 3b6f34f..bbd4fb9 100644
--- a/modules/services/syncthing/default.nix
+++ b/modules/services/syncthing/default.nix
@@ -1,11 +1,17 @@
 { config, pkgs, lib, ... }:
 let cfg = config.my.services.syncthing;
 in {
-  services.syncthing = {
-    enable = true;
-    openDefaultPorts = true;
-    user = config.users.users.fcuny;
-    group = "users";
-    dataDir = "${config.users.users.fcuny.home}/.syncthing";
+  options.my.services.syncthing = with lib; {
+    enable = mkEnableOption "syncthing service";
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.syncthing = {
+      enable = true;
+      openDefaultPorts = true;
+      user = users.users.fcuny;
+      group = "users";
+      dataDir = "${users.users.fcuny.home}/.syncthing";
+    };
   };
 }