summary refs log tree commit diff
path: root/nixos/modules/services/networking/btsync.nix
diff options
context:
space:
mode:
authorOliver Matthews <oliver@codersoffortune.net>2015-04-06 15:31:40 +0000
committerOliver Matthews <oliver@codersoffortune.net>2015-04-06 15:31:40 +0000
commit0539ed477151a3adfff5012cabff0527a9a8c0bb (patch)
tree01a1bce66f4b7b3fa5816666bf9875e05c29a40b /nixos/modules/services/networking/btsync.nix
parent16730fa87aea11333933202637233c530fc182fc (diff)
downloadnixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.tar
nixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.tar.gz
nixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.tar.bz2
nixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.tar.lz
nixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.tar.xz
nixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.tar.zst
nixpkgs-0539ed477151a3adfff5012cabff0527a9a8c0bb.zip
Add support for btsync 2.x branch
Diffstat (limited to 'nixos/modules/services/networking/btsync.nix')
-rw-r--r--nixos/modules/services/networking/btsync.nix27
1 files changed, 24 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/btsync.nix b/nixos/modules/services/networking/btsync.nix
index 34bddf90873..0bfd3b74348 100644
--- a/nixos/modules/services/networking/btsync.nix
+++ b/nixos/modules/services/networking/btsync.nix
@@ -4,6 +4,9 @@ with lib;
 
 let
   cfg = config.services.btsync;
+
+  bittorrentSync = cfg.package;
+
   listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort);
 
   boolStr = x: if x then "true" else "false";
@@ -57,7 +60,7 @@ let
     ''
       {
         "device_name":     "${cfg.deviceName}",
-        "storage_path":    "/var/lib/btsync/",
+        "storage_path":    "${cfg.storagePath}",
         "listening_port":  ${toString cfg.listeningPort},
         "use_gui":         false,
 
@@ -195,6 +198,24 @@ in
           '';
       };
 
+      package = mkOption {
+        type = types.package;
+        default = pkgs.bittorrentSync14;
+        example = literalExample "pkgs.bittorrentSync20";
+        description = ''
+          Branch of bittorrent sync to use.
+        '';
+      };
+
+      storagePath = mkOption {
+        type = types.path;
+        default = "/var/lib/btsync";
+        example = "/var/lib/btsync";
+        description = ''
+          Where to store the bittorrent sync files.
+        '';
+      };
+
       apiKey = mkOption {
         type = types.str;
         default = "";
@@ -258,7 +279,7 @@ in
 
     users.extraUsers.btsync = {
       description     = "Bittorrent Sync Service user";
-      home            = "/var/lib/btsync";
+      home            = cfg.storagePath;
       createHome      = true;
       uid             = config.ids.uids.btsync;
       group           = "btsync";
@@ -292,6 +313,6 @@ in
       };
     };
 
-    environment.systemPackages = [ pkgs.bittorrentSync ];
+    environment.systemPackages = [ cfg.package ];
   };
 }