2022-06-16 17:23:12 +00:00
|
|
|
{ lib, buildGoModule, fetchurl, nixosTests, openssl, pkg-config }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
2022-10-06 18:32:54 +00:00
|
|
|
pname = "kubo";
|
2023-04-12 12:48:02 +00:00
|
|
|
version = "0.19.1"; # When updating, also check if the repo version changed and adjust repoVersion below
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
passthru.repoVersion = "13"; # Also update kubo-migrator when changing the repo version
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
# Kubo makes changes to it's source tarball that don't match the git source.
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchurl {
|
2022-08-12 12:06:08 +00:00
|
|
|
url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
|
2023-04-12 12:48:02 +00:00
|
|
|
hash = "sha256-gQIJKV5MD0TZ0GYdLFWNePnExThqEjUmZKCAHhGwtMU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
# tarball contains multiple files/directories
|
|
|
|
postUnpack = ''
|
2022-10-06 18:32:54 +00:00
|
|
|
mkdir kubo-src
|
2020-09-25 04:45:31 +00:00
|
|
|
shopt -s extglob
|
2022-10-06 18:32:54 +00:00
|
|
|
mv !(kubo-src) kubo-src || true
|
|
|
|
cd kubo-src
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
subPackages = [ "cmd/ipfs" ];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildInputs = [ openssl ];
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
tags = [ "openssl" ];
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
passthru.tests.kubo = nixosTests.kubo;
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
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; {
|
2023-03-04 12:14:45 +00:00
|
|
|
description = "An IPFS implementation in Go";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://ipfs.io/";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
2022-10-06 18:32:54 +00:00
|
|
|
mainProgram = "ipfs";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ fpletz ];
|
|
|
|
};
|
|
|
|
}
|