git.iko.soy/typeable/nixpkgs
on master help sign in
Add support for btsync 2.x branch
commit0539ed477151a3adfff5012cabff0527a9a8c0bb authorOliver Matthews <oliver@codersoffortune.net> dateMon 6 Apr 2015, 15:31 (12 years ago) parent16730fa
5 files changed+70−4
lib/maintainers.nix+1 nixos/modules/services/networking/btsync.nix+24−3 pkgs/applications/networking/bittorrentsync/default.nix → pkgs/applications/networking/bittorrentsync/1.4.x.nix pkgs/applications/networking/bittorrentsync/2.0.x.nix+42 pkgs/top-level/all-packages.nix+3−1
lib/maintainers.nix+1
@@ -54,6 +54,7 @@
5454 copumpkin = "Dan Peebles <pumpkingod@gmail.com>";
5555 coroa = "Jonas Hörsch <jonas@chaoflow.net>";
5656 cstrahan = "Charles Strahan <charles.c.strahan@gmail.com>";
57+ cwoac = "Oliver Matthews <oliver@codersoffortune.net>";
5758 DamienCassou = "Damien Cassou <damien.cassou@gmail.com>";
5859 davidrusu = "David Rusu <davidrusu.me@gmail.com>";
5960 dbohdan = "Danyil Bohdan <danyil.bohdan@gmail.com>";
nixos/modules/services/networking/btsync.nix+24−3
@@ -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}
pkgs/applications/networking/bittorrentsync/default.nix → pkgs/applications/networking/bittorrentsync/1.4.x.nixrenamed

The content is the same.

pkgs/applications/networking/bittorrentsync/2.0.x.nixnew file+42
@@ -0,0 +1,42 @@
1+{ stdenv, fetchurl, patchelf }:
2+
3+let
4+ arch = if stdenv.system == "x86_64-linux" then "x64"
5+ else if stdenv.system == "i686-linux" then "i386"
6+ else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
7+
8+ sha256 = if stdenv.system == "x86_64-linux" then "cbce76f73f47c23d9073644504fa454976629450d008354bd8faef1bddf368fd"
9+ else if stdenv.system == "i686-linux" then "d3e8583c8a54cbeb34ea3621daf0498316a959d944b30f24aa4e518a851ecdeb"
10+ else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
11+
12+ libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.libc ];
13+in
14+stdenv.mkDerivation rec {
15+ name = "btsync-${version}";
16+ version = "2.0.93";
17+
18+ src = fetchurl {
19+ url = "http://syncapp.bittorrent.com/${version}/btsync_${arch}-${version}.tar.gz";
20+ inherit sha256;
21+ };
22+
23+ dontStrip = true; # Don't strip, otherwise patching the rpaths breaks
24+ sourceRoot = ".";
25+ buildInputs = [ patchelf ];
26+
27+ installPhase = ''
28+ mkdir -p "$out/bin/"
29+ cp -r "btsync" "$out/bin/"
30+
31+ patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
32+ --set-rpath ${libPath} "$out/bin/btsync"
33+ '';
34+
35+ meta = {
36+ description = "Automatically sync files via secure, distributed technology";
37+ homepage = "http://www.bittorrent.com/sync";
38+ license = stdenv.lib.licenses.unfreeRedistributable;
39+ platforms = stdenv.lib.platforms.linux;
40+ maintainers = with stdenv.lib.maintainers; [ iElectric thoughtpolice cwoac ];
41+ };
42+}
pkgs/top-level/all-packages.nix+3−1
@@ -11743,7 +11743,9 @@ let
1174311743
1174411744 sxiv = callPackage ../applications/graphics/sxiv { };
1174511745
11746− bittorrentSync = callPackage ../applications/networking/bittorrentsync { };
11746+ bittorrentSync = bittorrentSync14;
11747+ bittorrentSync14 = callPackage ../applications/networking/bittorrentsync/1.4.x.nix { };
11748+ bittorrentSync20 = callPackage ../applications/networking/bittorrentsync/2.0.x.nix { };
1174711749
1174811750 copy-com = callPackage ../applications/networking/copy-com { };
1174911751