diff --git a/pkgs/applications/networking/ipfs/default.nix b/pkgs/applications/networking/ipfs/default.nix index 79e2185f04e6..0d018c9588f6 100644 --- a/pkgs/applications/networking/ipfs/default.nix +++ b/pkgs/applications/networking/ipfs/default.nix @@ -1,22 +1,31 @@ -{ stdenv, buildGoPackage, fetchFromGitHub }: +{ stdenv, buildGoPackage, fetchFromGitHub, fetchgx }: 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"; + extraSrcPaths = [ + (fetchgx { + inherit name src; + sha256 = "0mm1rs2mbs3rmxfcji5yal9ai3v1w75kk05bfyhgzmcjvi6lwpyb"; + }) + ]; + src = fetchFromGitHub { owner = "ipfs"; repo = "go-ipfs"; inherit rev; - sha256 = "1b7aimnbz287fy7p27v3qdxnz514r5142v3jihqxanbk9g384gcd"; + sha256 = "06iq7fmq7p0854aqrnmd0f0jvnxy9958wvw7ibn754fdfii9l84l"; }; meta = with stdenv.lib; { description = "A global, versioned, peer-to-peer filesystem"; + homepage = https://ipfs.io/; license = licenses.mit; - broken = true; + platforms = platforms.unix; + maintainers = with maintainers; [ fpletz ]; }; } 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/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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 00dbcd96360f..051950156701 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;