diff --git a/packages/networking/ipfs/default.nix b/packages/networking/ipfs/default.nix index bfba170..8737ea8 100644 --- a/packages/networking/ipfs/default.nix +++ b/packages/networking/ipfs/default.nix @@ -1,51 +1,54 @@ -{ lib, buildGo118Module, fetchurl, nixosTests, openssl, pkg-config }: +{ lib +, buildGoModule +, fetchurl +, nixosTests +, callPackage +}: -buildGo118Module rec { - pname = "ipfs"; - version = "0.16.0"; # When updating, also check if the repo version changed and adjust repoVersion below +buildGoModule rec { + pname = "kubo"; + version = "0.23.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 + passthru.repoVersion = "15"; # Also update kubo-migrator when changing the repo version - # go-ipfs makes changes to it's source tarball that don't match the git source. + # 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"; - sha256 = "sha256-FS7lwQS7ybyoIKPkcUtPIe3srO1O/cZN+x1nzWUlF20="; + hash = "sha256-ycXn8h8sFGJXVMldneN51lZgXoPaZ/XeXLtqqJ4w6H0="; }; # tarball contains multiple files/directories postUnpack = '' - mkdir ipfs-src + mkdir kubo-src shopt -s extglob - mv !(ipfs-src) ipfs-src || true - cd ipfs-src + mv !(kubo-src) kubo-src || true + cd kubo-src ''; + patches = [ + ./ipfs-allow-publish-with-ipns-mounted.patch + ./ipfs-fuse-nuke-getxattr.patch + ]; + sourceRoot = "."; subPackages = [ "cmd/ipfs" ]; - buildInputs = [ openssl ]; - nativeBuildInputs = [ pkg-config ]; - tags = [ "openssl" ]; + passthru.tests = { + inherit (nixosTests) kubo; + repoVersion = callPackage ./test-repoVersion.nix {}; + }; - passthru.tests.ipfs = nixosTests.ipfs; - - vendorSha256 = null; + vendorHash = 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" + --replace '/usr/local/bin/ipfs' "$out/bin/ipfs" substituteInPlace 'misc/systemd/ipfs-hardened.service' \ - --replace '/usr/bin/ipfs' "$out/bin/ipfs" + --replace '/usr/local/bin/ipfs' "$out/bin/ipfs" ''; postInstall = '' @@ -59,10 +62,11 @@ buildGo118Module rec { ''; meta = with lib; { - description = "A global, versioned, peer-to-peer filesystem"; + description = "An IPFS implementation in Go"; homepage = "https://ipfs.io/"; license = licenses.mit; platforms = platforms.unix; - maintainers = with maintainers; [ fpletz ]; + mainProgram = "ipfs"; + maintainers = with maintainers; [ Luflosi fpletz ]; }; } diff --git a/packages/networking/ipfs/ipfs-allow-publish-with-ipns-mounted.patch b/packages/networking/ipfs/ipfs-allow-publish-with-ipns-mounted.patch index e133b2f..720a4c0 100644 --- a/packages/networking/ipfs/ipfs-allow-publish-with-ipns-mounted.patch +++ b/packages/networking/ipfs/ipfs-allow-publish-with-ipns-mounted.patch @@ -1,11 +1,11 @@ diff --git a/core/coreapi/coreapi.go b/core/coreapi/coreapi.go -index 5b638826b..32747fe53 100644 +index 81d05b58d..66460326f 100644 --- a/core/coreapi/coreapi.go +++ b/core/coreapi/coreapi.go -@@ -191,9 +191,6 @@ func (api *CoreAPI) WithOptions(opts ...options.ApiOption) (coreiface.CoreAPI, e +@@ -205,9 +205,6 @@ func (api *CoreAPI) WithOptions(opts ...options.ApiOption) (coreiface.CoreAPI, e } - subApi.checkPublishAllowed = func() error { + subAPI.checkPublishAllowed = func() error { - if n.Mounts.Ipns != nil && n.Mounts.Ipns.IsActive() { - return errors.New("cannot manually publish while IPNS is mounted") - } diff --git a/packages/networking/ipfs/ipfs-unsafe-allow-all-paths-for-filestore.patch b/packages/networking/ipfs/ipfs-unsafe-allow-all-paths-for-filestore.patch deleted file mode 100644 index 2ffdb65..0000000 --- a/packages/networking/ipfs/ipfs-unsafe-allow-all-paths-for-filestore.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/vendor/github.com/ipfs/go-filestore/fsrefstore.go b/vendor/github.com/ipfs/go-filestore/fsrefstore.go -index 9eb2b43..43e336c 100644 ---- a/vendor/github.com/ipfs/go-filestore/fsrefstore.go -+++ b/vendor/github.com/ipfs/go-filestore/fsrefstore.go -@@ -291,9 +291,6 @@ func (f *FileManager) putTo(ctx context.Context, b *posinfo.FilestoreNode, to pu - return ErrFilestoreNotEnabled - } - //lint:ignore SA1019 // ignore staticcheck -- if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) { -- return fmt.Errorf("cannot add filestore references outside ipfs root (%s)", f.root) -- } - - p, err := filepath.Rel(f.root, b.PosInfo.FullPath) - if err != nil { diff --git a/packages/networking/ipfs/lain-webui-0.14.0.patch b/packages/networking/ipfs/lain-webui-0.14.0.patch deleted file mode 100644 index 6109961..0000000 --- a/packages/networking/ipfs/lain-webui-0.14.0.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/core/corehttp/webui.go 2020-05-09 04:58:18.000000000 +0200 -+++ b/core/corehttp/webui.go 2020-07-15 00:22:00.439862559 +0200 -@@ -1,7 +1,7 @@ - package corehttp - - // TODO: move to IPNS --const WebUIPath = "/ipfs/bafybeibozpulxtpv5nhfa2ue3dcjx23ndh3gwr5vwllk7ptoyfwnfjjr4q" // v2.15.1 -+const WebUIPath = "/ipns/webui.ipfs.privatevoid.net" - - // this is a list of all past webUI paths. - var WebUIPaths = []string{