2021-02-05 17:12:51 +00:00
|
|
|
{ lib, buildGoModule, fetchurl, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "ipfs";
|
2022-03-05 16:20:37 +00:00
|
|
|
version = "0.12.0"; # When updating, also check if the repo version changed and adjust repoVersion below
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
repoVersion = "12"; # Also update ipfs-migrator when changing the repo 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";
|
2022-03-05 16:20:37 +00:00
|
|
|
sha256 = "jWoMm/xIp3Zn/FiHWQ5/q39i6Lh4Fdoi9OdnRVc51Xk=";
|
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
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
outputs = [ "out" "systemd_unit" "systemd_unit_hardened" ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace 'misc/systemd/ipfs.service' \
|
|
|
|
--replace '/usr/bin/ipfs' "$out/bin/ipfs"
|
|
|
|
substituteInPlace 'misc/systemd/ipfs-hardened.service' \
|
|
|
|
--replace '/usr/bin/ipfs' "$out/bin/ipfs"
|
|
|
|
'';
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
postInstall = ''
|
2022-03-30 09:31:56 +00:00
|
|
|
install --mode=444 -D 'misc/systemd/ipfs-api.socket' "$systemd_unit/etc/systemd/system/ipfs-api.socket"
|
|
|
|
install --mode=444 -D 'misc/systemd/ipfs-gateway.socket' "$systemd_unit/etc/systemd/system/ipfs-gateway.socket"
|
|
|
|
install --mode=444 -D 'misc/systemd/ipfs.service' "$systemd_unit/etc/systemd/system/ipfs.service"
|
|
|
|
|
|
|
|
install --mode=444 -D 'misc/systemd/ipfs-api.socket' "$systemd_unit_hardened/etc/systemd/system/ipfs-api.socket"
|
|
|
|
install --mode=444 -D 'misc/systemd/ipfs-gateway.socket' "$systemd_unit_hardened/etc/systemd/system/ipfs-gateway.socket"
|
|
|
|
install --mode=444 -D 'misc/systemd/ipfs-hardened.service' "$systemd_unit_hardened/etc/systemd/system/ipfs.service"
|
2020-06-18 07:06:33 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A global, versioned, peer-to-peer filesystem";
|
|
|
|
homepage = "https://ipfs.io/";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ fpletz ];
|
|
|
|
};
|
|
|
|
}
|