Merge pull request #51876 from Mic92/go-cleanup

Go cleanup: use buildGoPackage whenever possible
This commit is contained in:
Jörg Thalheim 2018-12-12 08:56:21 +00:00 committed by GitHub
commit 8e3b400b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 125 deletions

@ -1,37 +0,0 @@
{ stdenv, go, fetchFromGitHub }:
stdenv.mkDerivation rec {
name = "acbuild-${version}";
version = "0.4.0";
src = fetchFromGitHub {
owner = "appc";
repo = "acbuild";
rev = "v${version}";
sha256 = "0s81xlaw75d05b4cidxml978hnxak8parwpnk9clanwqjbj66c7x";
};
buildInputs = [ go ];
patchPhase = ''
sed -i -e 's|\git describe --dirty|echo "${version}"|' build
'';
buildPhase = ''
patchShebangs build
./build
'';
installPhase = ''
mkdir -p $out
mv bin $out
'';
meta = with stdenv.lib; {
description = "A build tool for ACIs";
homepage = https://github.com/appc/acbuild;
license = licenses.asl20;
maintainers = with maintainers; [ dgonyeo ];
platforms = platforms.linux;
};
}

@ -1,26 +0,0 @@
{ stdenv, fetchFromGitHub, go }:
stdenv.mkDerivation rec {
name = "logstash-forwarder-${version}";
version = "0.4.0";
src = fetchFromGitHub {
owner = "elasticsearch";
repo = "logstash-forwarder";
rev = "v${version}";
sha256 = "05g7366w8f7h75n1ia7njdpmparr6sfvn45xxfh5412zigqidz6l";
};
buildInputs = [ go ];
installPhase = ''
mkdir -p $out/bin
find . -name logstash-forwarder -type f -exec cp {} $out/bin \;
'';
meta = {
license = stdenv.lib.licenses.asl20;
homepage = https://github.com/elasticsearch/logstash-forwarder;
platforms = stdenv.lib.platforms.unix;
};
}

@ -1,18 +1,25 @@
{ stdenv, fetchFromGitHub, go }:
{ buildGoPackage, stdenv, fetchFromGitHub }:
stdenv.mkDerivation {
name = "curl-unix-socket-2014-09-01";
buildGoPackage rec {
name = "curl-unix-socket-2015-04-10";
src = fetchFromGitHub {
owner = "Soulou";
repo = "curl-unix-socket";
rev = "e926dca77ba7d4a1eeae073918fdd3db92f1a350";
rev = "a7da90b01ed43e8c0d606f760c9da82f8e3ed307";
sha256 = "1ynrrav90y3dhk8jq2fxm3jswj5nvrffwslgykj429hk6n0czb3d";
};
buildInputs = [ go ];
buildPhase = "go build -o curl-unix-socket";
installPhase = "install -D curl-unix-socket $out/bin/curl-unix-socket";
goPackagePath = "github.com/Soulou/curl-unix-socket";
buildPhase = ''
runHook preBuild
(
cd go/src/${goPackagePath}
go build -o $NIX_BUILD_TOP/go/bin/curl-unix-socket
)
runHook postBuild
'';
meta = with stdenv.lib; {
description = "Run HTTP requests over UNIX socket";

@ -1,16 +1,6 @@
{ stdenv, fetchurl, fetchgit, go }:
{ buildGoPackage, stdenv, fetchurl }:
let
# Code with BSD license
srcNatPMP = fetchgit {
url = https://github.com/jackpal/go-nat-pmp;
rev = "e04deda90d56";
sha256 = "1swwfyzaj3l40yh9np3x4fcracgs79nwryc85sxbdakx8wwxs2xb";
};
in
stdenv.mkDerivation rec {
buildGoPackage rec {
name = "filegive-0.7.4";
src = fetchurl {
@ -18,30 +8,15 @@ stdenv.mkDerivation rec {
sha256 = "1z3vyqfdp271qa5ah0i6jmn9gh3gb296wcm33sd2zfjqapyh12hy";
};
buildInputs = [ go ];
goDeps = ./deps.nix;
buildPhase = ''
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "armv5tel-linux") "export GOARM=5"}
goPackagePath = "viric.name/soft/filegive";
mkdir $TMPDIR/go
export GOPATH=$TMPDIR/go
GONATPMP=$GOPATH/src/code.google.com/p/go-nat-pmp
mkdir -p $GONATPMP
cp -R ${srcNatPMP}/* $GONATPMP/
go build -o filegive
'';
installPhase = ''
mkdir -p $out/bin
cp filegive $out/bin
'';
meta = {
meta = with stdenv.lib; {
homepage = http://viric.name/cgi-bin/filegive;
description = "Easy p2p file sending program";
license = stdenv.lib.licenses.agpl3Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
license = licenses.agpl3Plus;
maintainers = [ maintainers.viric ];
platforms = platforms.linux;
};
}

12
pkgs/tools/networking/filegive/deps.nix generated Normal file

@ -0,0 +1,12 @@
# This file was generated by https://github.com/kamilchm/go2nix v1.3.0
[
{
goPackagePath = "code.google.com/p/go-nat-pmp";
fetch = {
type = "git";
url = "https://github.com/jackpal/go-nat-pmp";
rev = "e04deda90d5683d6e375732740814a89eea7bafd";
sha256 = "1swwfyzaj3l40yh9np3x4fcracgs79nwryc85sxbdakx8wwxs2xb";
};
}
]

@ -1,30 +1,18 @@
{ stdenv, fetchFromGitHub, go }:
{ buildGoPackage, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
version = "1.1.0";
buildGoPackage rec {
version = "2.0.0";
name = "xurls-${version}";
src = fetchFromGitHub {
owner = "mvdan";
repo = "xurls";
rev = "v${version}";
sha256 = "05q4nqbpgfb0a35sn22rn9mlag2ks4cgwb54dx925hipp6zgj1hx";
sha256 = "1jdjwlp19r8cb7vycyrjmpwf8dz2fzrqphq4lkvy9x2v7x0kksx8";
};
buildInputs = [ go ];
buildPhase = ''
mkdir -p src/github.com/mvdan
ln -s $(pwd) src/github.com/mvdan/xurls
export GOPATH=$(pwd)
cd cmd/xurls
go build -v
'';
installPhase = ''
mkdir -p $out/bin
mv xurls $out/bin
'';
goPackagePath = "mvdan.cc/xurls/v2";
subPackages = [ "cmd/xurls" ];
meta = with stdenv.lib; {
description = "Extract urls from text";

@ -450,8 +450,6 @@ in
abduco = callPackage ../tools/misc/abduco { };
acbuild = callPackage ../applications/misc/acbuild { };
acct = callPackage ../tools/system/acct { };
accuraterip-checksum = callPackage ../tools/audio/accuraterip-checksum { };
@ -3738,8 +3736,6 @@ in
logstash-contrib = callPackage ../tools/misc/logstash/contrib.nix { };
logstash-forwarder = callPackage ../tools/misc/logstash-forwarder { };
lolcat = callPackage ../tools/misc/lolcat { };
lsdvd = callPackage ../tools/cd-dvd/lsdvd {};