68 lines
2.3 KiB
Nix
68 lines
2.3 KiB
Nix
{ lib, buildGo118Module, fetchurl, nixosTests, openssl, pkg-config }:
|
|
|
|
buildGo118Module rec {
|
|
pname = "ipfs";
|
|
version = "0.16.0"; # When updating, also check if the repo version changed and adjust repoVersion below
|
|
rev = "v${version}";
|
|
|
|
repoVersion = "12"; # Also update ipfs-migrator when changing the repo version
|
|
|
|
# go-ipfs makes changes to it's source tarball that don't match the git source.
|
|
src = fetchurl {
|
|
url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
|
|
sha256 = "sha256-FS7lwQS7ybyoIKPkcUtPIe3srO1O/cZN+x1nzWUlF20=";
|
|
};
|
|
|
|
# tarball contains multiple files/directories
|
|
postUnpack = ''
|
|
mkdir ipfs-src
|
|
shopt -s extglob
|
|
mv !(ipfs-src) ipfs-src || true
|
|
cd ipfs-src
|
|
'';
|
|
|
|
sourceRoot = ".";
|
|
|
|
subPackages = [ "cmd/ipfs" ];
|
|
|
|
buildInputs = [ openssl ];
|
|
nativeBuildInputs = [ pkg-config ];
|
|
tags = [ "openssl" ];
|
|
|
|
passthru.tests.ipfs = nixosTests.ipfs;
|
|
|
|
vendorSha256 = null;
|
|
|
|
outputs = [ "out" "systemd_unit" "systemd_unit_hardened" ];
|
|
|
|
patches = [
|
|
./ipfs-allow-publish-with-ipns-mounted.patch
|
|
./ipfs-fuse-nuke-getxattr.patch
|
|
./ipfs-unsafe-allow-all-paths-for-filestore.patch
|
|
];
|
|
|
|
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"
|
|
'';
|
|
|
|
postInstall = ''
|
|
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"
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A global, versioned, peer-to-peer filesystem";
|
|
homepage = "https://ipfs.io/";
|
|
license = licenses.mit;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ fpletz ];
|
|
};
|
|
}
|