ctucx.git: nixfiles

ctucx' nixfiles

commit a3e9b6f93f83d4d76dc6c986492ffb6971e62d83
parent 63e404094d94b5f8e51fed34aa028b1f7f12adf3
Author: Leah (ctucx) <git@ctu.cx>
Date: Thu, 12 Jan 2023 23:31:30 +0100

improvements to syncthing
5 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/configurations/common/syncthing-config.nix b/configurations/common/syncthing-config.nix
@@ -67,9 +67,7 @@ let
     else
       false;
 
-  appendDataDirHosts = [ "desastro" "lollo" "taurus" ];
-  homeDir            = if pkgs.stdenv.isLinux then "/home" else "/Users";
-  dataDir            = "${homeDir}/leah" + (if builtins.elem config.networking.hostName appendDataDirHosts then "/syncthing" else "");
+  dataDir            = config.services.syncthing.dataDir;
 
 in {
 
diff --git a/configurations/darwin/syncthing.nix b/configurations/darwin/syncthing.nix
@@ -12,7 +12,7 @@ in {
       user    = "leah";
       group   = "staff";
 
-      dataDir = syncthingConfig.dataDir;
+      dataDir = "/Users/leah";
       devices = syncthingConfig.devices;
       folders = syncthingConfig.folders;
     };
diff --git a/configurations/linux/services/syncthing-nginx.nix b/configurations/linux/services/syncthing-nginx.nix
@@ -13,6 +13,7 @@
   services = {
     syncthing = {
       guiAddress = "127.0.0.1:8384";
+      extraOptions.gui.insecureSkipHostcheck = true;
     };
 
     nginx = {
diff --git a/configurations/linux/services/syncthing.nix b/configurations/linux/services/syncthing.nix
@@ -16,24 +16,23 @@ in {
     };
   };
 
-  services = {
-    syncthing = {
-      enable           = true;
-      openDefaultPorts = true;
+  systemd.services.syncthing.onFailure = [ "email-notify@%i.service" ];
 
-      user             = "leah";
-      group            = "users";
+  services.syncthing = {
+    enable           = true;
+    openDefaultPorts = true;
 
-      key              = config.age.secrets.syncthing-key.path;
-      cert             = config.age.secrets.syncthing-cert.path;
+    user             = "leah";
+    group            = "users";
 
-      dataDir          = syncthingConfig.dataDir;
-      configDir        = "/home/leah/.config/syncthing";
+    key              = lib.mkDefault config.age.secrets.syncthing-key.path;
+    cert             = lib.mkDefault config.age.secrets.syncthing-cert.path;
 
-      devices          = syncthingConfig.devices;
+    dataDir          = lib.mkDefault "/home/leah";
+    configDir        = lib.mkDefault "/home/leah/.config/syncthing";
 
-      folders          = syncthingConfig.folders;
-
-    };
+    devices          = syncthingConfig.devices;
+    folders          = syncthingConfig.folders;
   };
+
 }
diff --git a/machines/desastro/configuration.nix b/machines/desastro/configuration.nix
@@ -72,6 +72,7 @@
 
   services = {
     email-notify.enable = true;
+    syncthing.dataDir   = "/home/leah/syncthing";
     vnstat.enable       = true;
   };