51 lines
1.7 KiB
Nix
51 lines
1.7 KiB
Nix
{ stdenv, fetchurl, fetchgit, go }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "syncthing-${version}";
|
|
version = "0.7.1";
|
|
|
|
src = fetchgit {
|
|
url = "git://github.com/calmh/syncthing.git";
|
|
rev = "refs/tags/v${version}";
|
|
sha256 = "1rja837kimiq15km8cridbm5yxvkm6mkvkwywdi76qf9rm0pcjl1";
|
|
};
|
|
|
|
buildInputs = [ go ];
|
|
|
|
buildPhase = ''
|
|
mkdir -p "./dependencies/src/github.com/calmh/syncthing"
|
|
|
|
cp -r "./auto" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./buffers" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./cid" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./discover" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./files" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./lamport" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./protocol" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./scanner" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./mc" "./dependencies/src/github.com/calmh/syncthing"
|
|
cp -r "./xdr" "./dependencies/src/github.com/calmh/syncthing"
|
|
|
|
export GOPATH="`pwd`/Godeps/_workspace:`pwd`/dependencies"
|
|
|
|
go test -cpu=1,2,4 ./...
|
|
|
|
mkdir ./bin
|
|
|
|
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
|
|
'';
|
|
|
|
installPhase = ''
|
|
ensureDir $out/bin
|
|
cp -r ./bin $out
|
|
'';
|
|
|
|
meta = {
|
|
homepage = http://syncthing.net/;
|
|
description = "Syncthing 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;
|
|
};
|
|
}
|