From 24e4d4d76ac16002d02e8432b502d2e9a77f0d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20G=C3=BCntner?= Date: Thu, 27 Oct 2016 18:46:40 +0200 Subject: [PATCH 1/4] ipfs: i20160112 -> 0.4.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - switched from rev to official release - added preBuild to install gx dependencies - removed broken flag Signed-off-by: Maximilian Güntner --- pkgs/applications/networking/ipfs/default.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/networking/ipfs/default.nix b/pkgs/applications/networking/ipfs/default.nix index 79e2185f04e6..7f598378d75e 100644 --- a/pkgs/applications/networking/ipfs/default.nix +++ b/pkgs/applications/networking/ipfs/default.nix @@ -1,9 +1,9 @@ -{ stdenv, buildGoPackage, fetchFromGitHub }: +{ stdenv, buildGoPackage, fetchFromGitHub, gx, gx-go }: buildGoPackage rec { name = "ipfs-${version}"; - version = "i20160112--${stdenv.lib.strings.substring 0 7 rev}"; - rev = "7070b4d878baad57dcc8da80080dd293aa46cabd"; + version = "0.4.4"; + rev = "d905d485192616abaea25f7e721062a9e1093ab9"; goPackagePath = "github.com/ipfs/go-ipfs"; @@ -11,12 +11,18 @@ buildGoPackage rec { owner = "ipfs"; repo = "go-ipfs"; inherit rev; - sha256 = "1b7aimnbz287fy7p27v3qdxnz514r5142v3jihqxanbk9g384gcd"; + sha256 = "06iq7fmq7p0854aqrnmd0f0jvnxy9958wvw7ibn754fdfii9l84l"; }; + buildInputs = [ gx gx-go ]; + + # Extra build step for gx dependecies + preBuild = '' + (cd "go/src/${goPackagePath}"; gx install) + ''; + meta = with stdenv.lib; { description = "A global, versioned, peer-to-peer filesystem"; license = licenses.mit; - broken = true; }; } From ff04adf871189b47f13f574aa0f2a0ca0877aca6 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sat, 29 Oct 2016 05:17:27 +0200 Subject: [PATCH 2/4] fetchgx: fetch dependencies with gx and gx-go --- pkgs/build-support/fetchgx/default.nix | 30 ++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/build-support/fetchgx/default.nix diff --git a/pkgs/build-support/fetchgx/default.nix b/pkgs/build-support/fetchgx/default.nix new file mode 100644 index 000000000000..c72bbec66321 --- /dev/null +++ b/pkgs/build-support/fetchgx/default.nix @@ -0,0 +1,30 @@ +{ stdenv, gx, gx-go, go, cacert }: + +{ name, src, sha256 }: + +stdenv.mkDerivation { + name = "${name}-gxdeps"; + inherit src; + + buildInputs = [ go gx gx-go ]; + + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = sha256; + + phases = [ "unpackPhase" "buildPhase" "installPhase" ]; + + SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + + buildPhase = '' + export GOPATH=$(pwd)/vendor + mkdir vendor + gx install + ''; + + installPhase = '' + mv vendor $out + ''; + + preferLocalBuild = true; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1c65f9bbffdc..bcf6276146fe 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -250,6 +250,8 @@ in fetchNuGet = callPackage ../build-support/fetchnuget { }; buildDotnetPackage = callPackage ../build-support/build-dotnet-package { }; + fetchgx = callPackage ../build-support/fetchgx { }; + resolveMirrorURLs = {url}: fetchurl { showURLs = true; inherit url; From 2d934fdffb66ec60b9cd05d6e67a219e8db319e1 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sat, 29 Oct 2016 05:18:16 +0200 Subject: [PATCH 3/4] buildGoPackage: introduce extraSrcPaths option This option adds support for including sources from existing gopaths into the gopath of the package to build. --- pkgs/development/go-modules/generic/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index d4d2790b2a3c..e076c6ca90ed 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -1,4 +1,4 @@ -{ go, govers, parallel, lib, fetchgit, fetchhg }: +{ go, govers, parallel, lib, fetchgit, fetchhg, rsync }: { name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? "" @@ -17,6 +17,10 @@ # Extra sources to include in the gopath , extraSrcs ? [ ] +# Extra gopaths containing src subfolder +# with sources to include in the gopath +, extraSrcPaths ? [ ] + # go2nix dependency file , goDeps ? null @@ -86,6 +90,9 @@ go.stdenv.mkDerivation ( mv goPath/* "go/src/${goPackagePath}" rmdir goPath + '') + (lib.optionalString (extraSrcPaths != []) '' + ${rsync}/bin/rsync -a ${lib.concatMapStrings (p: "${p}/src") extraSrcPaths} go + '') + '' export GOPATH=$NIX_BUILD_TOP/go:$GOPATH From f9c65a97f869dad464379213d147cb3fece9c91a Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sat, 29 Oct 2016 05:19:41 +0200 Subject: [PATCH 4/4] ipfs: use fetchgx --- pkgs/applications/networking/ipfs/default.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/networking/ipfs/default.nix b/pkgs/applications/networking/ipfs/default.nix index 7f598378d75e..0d018c9588f6 100644 --- a/pkgs/applications/networking/ipfs/default.nix +++ b/pkgs/applications/networking/ipfs/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildGoPackage, fetchFromGitHub, gx, gx-go }: +{ stdenv, buildGoPackage, fetchFromGitHub, fetchgx }: buildGoPackage rec { name = "ipfs-${version}"; @@ -7,6 +7,13 @@ buildGoPackage rec { goPackagePath = "github.com/ipfs/go-ipfs"; + extraSrcPaths = [ + (fetchgx { + inherit name src; + sha256 = "0mm1rs2mbs3rmxfcji5yal9ai3v1w75kk05bfyhgzmcjvi6lwpyb"; + }) + ]; + src = fetchFromGitHub { owner = "ipfs"; repo = "go-ipfs"; @@ -14,15 +21,11 @@ buildGoPackage rec { sha256 = "06iq7fmq7p0854aqrnmd0f0jvnxy9958wvw7ibn754fdfii9l84l"; }; - buildInputs = [ gx gx-go ]; - - # Extra build step for gx dependecies - preBuild = '' - (cd "go/src/${goPackagePath}"; gx install) - ''; - meta = with stdenv.lib; { description = "A global, versioned, peer-to-peer filesystem"; + homepage = https://ipfs.io/; license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ fpletz ]; }; }