summary refs log tree commit diff
path: root/pkgs/applications/networking
diff options
context:
space:
mode:
authorLuca Bruno <lethalman88@gmail.com>2015-02-05 13:12:10 +0100
committerLuca Bruno <lethalman88@gmail.com>2015-02-05 13:12:10 +0100
commite6e4c867e5f9a4971a3234c0db2f8be712236673 (patch)
tree4c25feef59477de60eb96043580ab8151065f7bc /pkgs/applications/networking
parentd1b387473323a401572f5700276ee3e785486494 (diff)
downloadnixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.tar
nixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.tar.gz
nixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.tar.bz2
nixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.tar.lz
nixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.tar.xz
nixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.tar.zst
nixlib-e6e4c867e5f9a4971a3234c0db2f8be712236673.zip
Port syncthing to buildGoPackage
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r--pkgs/applications/networking/syncthing/default.nix34
1 files changed, 12 insertions, 22 deletions
diff --git a/pkgs/applications/networking/syncthing/default.nix b/pkgs/applications/networking/syncthing/default.nix
index e3c8d148ed8d..643100545551 100644
--- a/pkgs/applications/networking/syncthing/default.nix
+++ b/pkgs/applications/networking/syncthing/default.nix
@@ -1,40 +1,30 @@
-{ stdenv, fetchgit, go }:
+{ lib, fetchgit, goPackages }:
 
-stdenv.mkDerivation rec {
+with goPackages;
+
+buildGoPackage rec {
   name = "syncthing-${version}";
   version = "0.10.21";
-
+  goPackagePath = "github.com/syncthing/syncthing";
   src = fetchgit {
     url = "git://github.com/syncthing/syncthing.git";
     rev = "refs/tags/v${version}";
     sha256 = "60cd8607cf7d2837252680f6c2879aba1f35a2c74a47c2f2ea874d6eed2adaa5";
   };
 
-  buildInputs = [ go ];
-
-  buildPhase = ''
-    mkdir -p "./dependencies/src/github.com/syncthing/syncthing"
-    cp -r internal "./dependencies/src/github.com/syncthing/syncthing"
-
-    export GOPATH="`pwd`/Godeps/_workspace:`pwd`/dependencies"
-
-    go run build.go test
+  subPackages = [ "cmd/syncthing" ];
 
-    mkdir ./bin
+  buildFlagsArray = "-ldflags=-w -X main.Version v${version}";
 
-    go build -o ./bin/syncthing -ldflags "-w -X main.Version v${version}" ./cmd/syncthing
-  '';
+  preBuild = "export GOPATH=$GOPATH:$NIX_BUILD_TOP/go/src/${goPackagePath}/Godeps/_workspace";
 
-  installPhase = ''
-    mkdir -p $out/bin
-    cp -r ./bin $out
-  '';
+  doCheck = 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; linux;
   };
 }