ctucx.git: nixfiles

ctucx' nixfiles

commit 45e5d3efd96302e2c1e95d8736ac58b7d75b7a16
parent 1e55d6f1322afaf96e96db6f1bff67aa18a08805
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 20 Jan 2022 23:41:44 +0100

programs/syncthing: dynamic dataPath
1 file changed, 13 insertions(+), 11 deletions(-)
M
configurations/programs/syncthing.nix
|
24
+++++++++++++-----------
diff --git a/configurations/programs/syncthing.nix b/configurations/programs/syncthing.nix
@@ -13,6 +13,8 @@ let
   deviceNames    = builtins.attrNames (lib.filterAttrs isCurrentHost devices);
   isaDeviceNames = builtins.attrNames isaDevices;
 
+  dataDir        = "/home/leah" + (if config.networking.hostName == "desastro" then "/syncthing" else "");
+
 in {
   services = {
     syncthing = {

@@ -21,14 +23,14 @@ in {
       user             = "leah";
       group            = "users";
 
-      dataDir          = "/home/leah";
+      dataDir          = "${dataDir}";
       configDir        = "/home/leah/.config/syncthing";
 
       devices          = (lib.mkMerge [ (lib.filterAttrs isCurrentHost devices) isaDevices]);
 
       folders = {
 
-        "/home/leah/Audiobooks (Originals)" = {
+        "${dataDir}/Audiobooks (Originals)" = {
           enable            = (if config.networking.hostName == "stasicontainer" then true else false);
           id                = "ctucx-audiobooks-orig";
           label             = "Audiobooks (Originals}";

@@ -39,7 +41,7 @@ in {
           };
         };
 
-        "/home/leah/Audiobooks" = {
+        "${dataDir}/Audiobooks" = {
           id                = "ctucx-audiobooks";
           label             = "Audiobooks";
           devices           = deviceNames;

@@ -49,7 +51,7 @@ in {
           };
         };
 
-        "/home/leah/Documents" = {
+        "${dataDir}/Documents" = {
           id                = "ctucx-documents";
           label             = "Documents";
           devices           = deviceNames;

@@ -59,7 +61,7 @@ in {
           };
         };
 
-        "/home/leah/Music" = {
+        "${dataDir}/Music" = {
           id                = "ctucx-music";
           label             = "Music";
           devices           = deviceNames;

@@ -69,7 +71,7 @@ in {
           };
         };
 
-        "/home/leah/Music (Originals)" = {
+        "${dataDir}/Music (Originals)" = {
           enable            = (if config.networking.hostName == "stasicontainer" then true else false);
           id                = "ctucx-music-orig";
           label             = "Music (Originals)";

@@ -80,7 +82,7 @@ in {
           };
         };
 
-        "/home/leah/Pictures" = {
+        "${dataDir}/Pictures" = {
           id                = "ctucx-pictures";
           label             = "Pictures";
           devices           = deviceNames;

@@ -90,7 +92,7 @@ in {
           };
         };
 
-        "/home/leah/Videos" = {
+        "${dataDir}/Videos" = {
           id                = "ctucx-videos";
           label             = "Videos";
           devices           = deviceNames;

@@ -103,7 +105,7 @@ in {
 
 
 
-        "/home/leah/Bahn-Richtlinien" = {
+        "${dataDir}/Bahn-Richtlinien" = {
           id                = "Bahn-Richtlinien";
           label             = "Bahn-Richtlinien";
           devices           = (lib.mkMerge [ deviceNames isaDeviceNames]);

@@ -113,7 +115,7 @@ in {
           };
         };
 
-        "/home/leah/Cutieshare" = {
+        "${dataDir}/Cutieshare" = {
           id                = "cutieshare";
           label             = "Cutieshare";
           devices           = (lib.mkMerge [ deviceNames isaDeviceNames]);

@@ -123,7 +125,7 @@ in {
           };
         };
 
-        "/home/leah/Wiki" = {
+        "${dataDir}/Wiki" = {
           id                = "ctucx-wiki";
           label             = "Wiki";
           devices           = (lib.mkMerge [ deviceNames isaDeviceNames]);