@@ -4,6 +4,9 @@ with lib;
44
55let
66 cfg = config.services.btsync;
7+
8+ bittorrentSync = cfg.package;
9+
710 listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort);
811
912 boolStr = x: if x then "true" else "false";
@@ -57,7 +60,7 @@ let
5760 ''
5861 {
5962 "device_name": "${cfg.deviceName}",
60− "storage_path": "/var/lib/btsync/",
63+ "storage_path": "${cfg.storagePath}",
6164 "listening_port": ${toString cfg.listeningPort},
6265 "use_gui": false,
6366
@@ -195,6 +198,24 @@ in
195198 '';
196199 };
197200
201+ package = mkOption {
202+ type = types.package;
203+ default = pkgs.bittorrentSync14;
204+ example = literalExample "pkgs.bittorrentSync20";
205+ description = ''
206+ Branch of bittorrent sync to use.
207+ '';
208+ };
209+
210+ storagePath = mkOption {
211+ type = types.path;
212+ default = "/var/lib/btsync";
213+ example = "/var/lib/btsync";
214+ description = ''
215+ Where to store the bittorrent sync files.
216+ '';
217+ };
218+
198219 apiKey = mkOption {
199220 type = types.str;
200221 default = "";
@@ -258,7 +279,7 @@ in
258279
259280 users.extraUsers.btsync = {
260281 description = "Bittorrent Sync Service user";
261− home = "/var/lib/btsync";
282+ home = cfg.storagePath;
262283 createHome = true;
263284 uid = config.ids.uids.btsync;
264285 group = "btsync";
@@ -292,6 +313,6 @@ in
292313 };
293314 };
294315
295− environment.systemPackages = [ pkgs.bittorrentSync ];
316+ environment.systemPackages = [ cfg.package ];
296317 };
297318}