depot/third_party/nixpkgs/pkgs/by-name/ku/kubo/package.nix
Luke Granger-Brown f92e137cfb
Some checks failed
/ combine-systems (push) Blocked by required conditions
/ build (x86_64-linux) (push) Failing after 11m44s
/ build (aarch64-linux) (push) Failing after 11m50s
/ build (push) Failing after 16m42s
Merge commit '1e2ed035f4bebc9adad02b365508ad96f7df87c1' into HEAD
2025-03-02 02:23:32 +00:00

75 lines
2.3 KiB
Nix

{
lib,
buildGoModule,
fetchurl,
nixosTests,
callPackage,
}:
buildGoModule rec {
pname = "kubo";
version = "0.33.2"; # When updating, also check if the repo version changed and adjust repoVersion below
rev = "v${version}";
passthru.repoVersion = "16"; # Also update kubo-migrator when changing the repo version
# Kubo makes changes to its source tarball that don't match the git source.
src = fetchurl {
url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
hash = "sha256-PSXX1mLteeLpaq74PnWeDy+E6E3uVWr1c5+FTMBKc5g=";
};
# tarball contains multiple files/directories
postUnpack = ''
mkdir kubo-src
shopt -s extglob
mv !(kubo-src) kubo-src || true
cd kubo-src
'';
sourceRoot = ".";
subPackages = [ "cmd/ipfs" ];
passthru.tests = {
inherit (nixosTests) kubo;
repoVersion = callPackage ./test-repoVersion.nix { };
};
vendorHash = null;
outputs = [
"out"
"systemd_unit"
"systemd_unit_hardened"
];
postPatch = ''
substituteInPlace 'misc/systemd/ipfs.service' \
--replace-fail '/usr/local/bin/ipfs' "$out/bin/ipfs"
substituteInPlace 'misc/systemd/ipfs-hardened.service' \
--replace-fail '/usr/local/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 = "IPFS implementation in Go";
homepage = "https://ipfs.io/";
changelog = "https://github.com/ipfs/kubo/releases/tag/${rev}";
license = licenses.mit;
platforms = platforms.unix;
mainProgram = "ipfs";
maintainers = with maintainers; [
Luflosi
];
};
}