2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
2023-10-19 13:55:26 +00:00
|
|
|
, callPackage
|
2023-10-09 19:29:22 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
2022-10-06 18:32:54 +00:00
|
|
|
pname = "kubo";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "0.29.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}";
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
passthru.repoVersion = "15"; # Also update kubo-migrator when changing the repo version
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# Kubo makes changes to its 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";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-udCVyA3NN3RCmVtdIjccfy/RymvrsGJoxlF8DiapP4g=";
|
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" ];
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) kubo;
|
|
|
|
repoVersion = callPackage ./test-repoVersion.nix {};
|
|
|
|
};
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
vendorHash = 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' \
|
2024-06-20 14:57:18 +00:00
|
|
|
--replace-fail '/usr/local/bin/ipfs' "$out/bin/ipfs"
|
2022-03-30 09:31:56 +00:00
|
|
|
substituteInPlace 'misc/systemd/ipfs-hardened.service' \
|
2024-06-20 14:57:18 +00:00
|
|
|
--replace-fail '/usr/local/bin/ipfs' "$out/bin/ipfs"
|
2022-03-30 09:31:56 +00:00
|
|
|
'';
|
|
|
|
|
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; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "IPFS implementation in Go";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://ipfs.io/";
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://github.com/ipfs/kubo/releases/tag/${rev}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
2022-10-06 18:32:54 +00:00
|
|
|
mainProgram = "ipfs";
|
2023-05-24 13:37:59 +00:00
|
|
|
maintainers = with maintainers; [ Luflosi fpletz ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|