summary refs log tree commit diff
path: root/pkgs/applications/networking/syncthing/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/syncthing/default.nix')
-rw-r--r--pkgs/applications/networking/syncthing/default.nix45
1 files changed, 16 insertions, 29 deletions
diff --git a/pkgs/applications/networking/syncthing/default.nix b/pkgs/applications/networking/syncthing/default.nix
index 64bf287b44f..430ab70caa1 100644
--- a/pkgs/applications/networking/syncthing/default.nix
+++ b/pkgs/applications/networking/syncthing/default.nix
@@ -1,45 +1,32 @@
-{ stdenv, fetchurl, fetchgit, go }:
+{ lib, fetchgit, goPackages }:
 
-stdenv.mkDerivation rec {
-  name = "syncthing-${version}";
-  version = "0.8.15";
+with goPackages;
 
+buildGoPackage rec {
+  name = "syncthing-${version}";
+  version = "0.10.30";
+  goPackagePath = "github.com/syncthing/syncthing";
   src = fetchgit {
-    url = "git://github.com/calmh/syncthing.git";
+    url = "git://github.com/syncthing/syncthing.git";
     rev = "refs/tags/v${version}";
-    sha256 = "0xv8kaji60zqxws72srh5hdi9fyvaipdcsawp6gcyahhr3cz0ddq";
+    sha256 = "bd554d42586c85e0a5e766b6a6e87ccc6047f30e189753a1e68e44fd54ca506a";
   };
 
-  buildInputs = [ go ];
-
-  buildPhase = ''
-    mkdir -p "./dependencies/src/github.com/calmh/syncthing"
-
-    for a in auto buffers cid discover files lamport protocol scanner \
-            logger beacon config xdr upnp model osutil versioner; do
-        cp -r "./$a" "./dependencies/src/github.com/calmh/syncthing"
-    done
-
-    export GOPATH="`pwd`/Godeps/_workspace:`pwd`/dependencies"
+  subPackages = [ "cmd/syncthing" ];
 
-    go test -cpu=1,2,4 ./...
+  buildFlagsArray = "-ldflags=-w -X main.Version v${version}";
 
-    mkdir ./bin
+  preBuild = "export GOPATH=$GOPATH:$NIX_BUILD_TOP/go/src/${goPackagePath}/Godeps/_workspace";
 
-    go build -o ./bin/syncthing -ldflags "-w -X main.Version v${version}" ./cmd/syncthing
-    go build -o ./bin/stcli -ldflags "-w -X main.Version v${version}" ./cmd/stcli
-  '';
+  doCheck = true;
 
-  installPhase = ''
-    mkdir -p $out/bin
-    cp -r ./bin $out
-  '';
+  dontInstallSrc = true;
 
   meta = {
     homepage = http://syncthing.net/;
     description = "Replaces Dropbox and BitTorrent Sync with something open, trustworthy and decentralized";
-    license = with stdenv.lib.licenses; mit;
-    maintainers = with stdenv.lib.maintainers; [ matejc ];
-    platforms = with stdenv.lib.platforms; linux;
+    license = with lib.licenses; mit;
+    maintainers = with lib.maintainers; [ matejc ];
+    platforms = with lib.platforms; unix;
   };
 }