2020-05-15 21:57:56 +00:00
|
|
|
{ stdenv, buildGoModule, fetchurl, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "ipfs";
|
2020-09-25 04:45:31 +00:00
|
|
|
version = "0.7.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
# go-ipfs makes changes to it's source tarball that don't match the git source.
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/ipfs/go-ipfs/releases/download/${rev}/go-ipfs-source.tar.gz";
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "1fkzwm4qxxpmbjammk6s5qcyjxivfa0ydqz4mpz1w756c4jq0jf3";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
# tarball contains multiple files/directories
|
|
|
|
postUnpack = ''
|
|
|
|
mkdir ipfs-src
|
2020-09-25 04:45:31 +00:00
|
|
|
shopt -s extglob
|
|
|
|
mv !(ipfs-src) ipfs-src || true
|
2020-05-15 21:57:56 +00:00
|
|
|
cd ipfs-src
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
subPackages = [ "cmd/ipfs" ];
|
|
|
|
|
|
|
|
passthru.tests.ipfs = nixosTests.ipfs;
|
|
|
|
|
|
|
|
vendorSha256 = null;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
postInstall = ''
|
2020-09-25 04:45:31 +00:00
|
|
|
install --mode=444 -D misc/systemd/ipfs.service $out/etc/systemd/system/ipfs.service
|
|
|
|
install --mode=444 -D misc/systemd/ipfs-api.socket $out/etc/systemd/system/ipfs-api.socket
|
|
|
|
install --mode=444 -D misc/systemd/ipfs-gateway.socket $out/etc/systemd/system/ipfs-gateway.socket
|
2020-06-18 07:06:33 +00:00
|
|
|
substituteInPlace $out/etc/systemd/system/ipfs.service \
|
|
|
|
--replace /usr/bin/ipfs $out/bin/ipfs
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|