Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubo: rename from ipfs #183349

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
./services/network-filesystems/drbd.nix
./services/network-filesystems/glusterfs.nix
./services/network-filesystems/kbfs.nix
./services/network-filesystems/ipfs.nix
./services/network-filesystems/kubo.nix
./services/network-filesystems/litestream/default.nix
./services/network-filesystems/netatalk.nix
./services/network-filesystems/nfsd.nix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ config, lib, pkgs, utils, ... }:
with lib;
let
cfg = config.services.ipfs;
cfg = config.services.kubo;

ipfsFlags = utils.escapeSystemdExecArgs (
kuboFlags = utils.escapeSystemdExecArgs (
optional cfg.autoMount "--mount" ++
optional cfg.enableGC "--enable-gc" ++
optional (cfg.serviceFdlimit != null) "--manage-fdlimit=false" ++
Expand Down Expand Up @@ -50,27 +50,27 @@ in

options = {

services.ipfs = {
services.kubo = {

enable = mkEnableOption (lib.mdDoc "Interplanetary File System (WARNING: may cause severe network degredation)");

package = mkOption {
type = types.package;
default = pkgs.ipfs;
defaultText = literalExpression "pkgs.ipfs";
description = lib.mdDoc "Which IPFS package to use.";
default = pkgs.kubo;
defaultText = literalExpression "pkgs.kubo";
description = lib.mdDoc "Which Kubo package to use.";
};

user = mkOption {
type = types.str;
default = "ipfs";
description = lib.mdDoc "User under which the IPFS daemon runs";
description = lib.mdDoc "User under which the Kubo daemon runs";
};

group = mkOption {
type = types.str;
default = "ipfs";
description = lib.mdDoc "Group under which the IPFS daemon runs";
description = lib.mdDoc "Group under which the Kubo daemon runs";
};

dataDir = mkOption {
Expand All @@ -84,7 +84,7 @@ in
then "/var/lib/ipfs"
else "/var/lib/ipfs/.ipfs"
'';
description = lib.mdDoc "The data dir for IPFS";
description = lib.mdDoc "The data dir for Kubo";
};

defaultMode = mkOption {
Expand All @@ -96,13 +96,13 @@ in
autoMount = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Whether IPFS should try to mount /ipfs and /ipns at startup.";
description = lib.mdDoc "Whether Kubo should try to mount /ipfs and /ipns at startup.";
};

autoMigrate = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc "Whether IPFS should try to run the fs-repo-migration at startup.";
description = lib.mdDoc "Whether Kubo should try to run the fs-repo-migration at startup.";
};

ipfsMountDir = mkOption {
Expand All @@ -126,7 +126,7 @@ in
apiAddress = mkOption {
type = types.str;
default = "/ip4/127.0.0.1/tcp/5001";
description = lib.mdDoc "Where IPFS exposes its API to";
description = lib.mdDoc "Where Kubo exposes its API to";
};

swarmAddress = mkOption {
Expand All @@ -137,7 +137,7 @@ in
"/ip4/0.0.0.0/udp/4001/quic"
"/ip6/::/udp/4001/quic"
];
description = lib.mdDoc "Where IPFS listens for incoming p2p connections";
description = lib.mdDoc "Where Kubo listens for incoming p2p connections";
};

enableGC = mkOption {
Expand Down Expand Up @@ -174,29 +174,29 @@ in

extraFlags = mkOption {
type = types.listOf types.str;
description = lib.mdDoc "Extra flags passed to the IPFS daemon";
description = lib.mdDoc "Extra flags passed to the Kubo daemon";
default = [ ];
};

localDiscovery = mkOption {
type = types.bool;
description = lib.mdDoc ''Whether to enable local discovery for the ipfs daemon.
This will allow ipfs to scan ports on your local network. Some hosting services will ban you if you do this.
description = lib.mdDoc ''Whether to enable local discovery for the Kubo daemon.
This will allow Kubo to scan ports on your local network. Some hosting services will ban you if you do this.
'';
default = false;
};

serviceFdlimit = mkOption {
type = types.nullOr types.int;
default = null;
description = lib.mdDoc "The fdlimit for the IPFS systemd unit or `null` to have the daemon attempt to manage it";
description = lib.mdDoc "The fdlimit for the Kubo systemd unit or `null` to have the daemon attempt to manage it";
example = 64 * 1024;
};

startWhenNeeded = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Whether to use socket activation to start IPFS when needed.";
description = lib.mdDoc "Whether to use socket activation to start Kubo when needed.";
};

};
Expand All @@ -223,7 +223,7 @@ in
uid = config.ids.uids.ipfs;
description = "IPFS daemon user";
packages = [
pkgs.ipfs-migrator
pkgs.kubo-migrator
];
};
};
Expand Down Expand Up @@ -255,7 +255,7 @@ in
# After an unclean shutdown this file may exist which will cause the config command to attempt to talk to the daemon. This will hang forever if systemd is holding our sockets open.
rm -vf "$IPFS_PATH/api"
'' + optionalString cfg.autoMigrate ''
${pkgs.ipfs-migrator}/bin/fs-repo-migrations -to '${cfg.package.repoVersion}' -y
${pkgs.kubo-migrator}/bin/fs-repo-migrations -to '${cfg.package.repoVersion}' -y
'' + ''
ipfs --offline config profile apply ${profile} >/dev/null
fi
Expand All @@ -279,7 +279,7 @@ in
| ipfs --offline config replace -
'';
serviceConfig = {
ExecStart = [ "" "${cfg.package}/bin/ipfs daemon ${ipfsFlags}" ];
ExecStart = [ "" "${cfg.package}/bin/ipfs daemon ${kuboFlags}" ];
User = cfg.user;
Group = cfg.group;
StateDirectory = "";
Expand Down Expand Up @@ -320,4 +320,27 @@ in
meta = {
maintainers = with lib.maintainers; [ Luflosi ];
};

imports = [
(mkRenamedOptionModule [ "services" "ipfs" "enable" ] [ "services" "kubo" "enable" ])
(mkRenamedOptionModule [ "services" "ipfs" "package" ] [ "services" "kubo" "package" ])
(mkRenamedOptionModule [ "services" "ipfs" "user" ] [ "services" "kubo" "user" ])
(mkRenamedOptionModule [ "services" "ipfs" "group" ] [ "services" "kubo" "group" ])
(mkRenamedOptionModule [ "services" "ipfs" "dataDir" ] [ "services" "kubo" "dataDir" ])
(mkRenamedOptionModule [ "services" "ipfs" "defaultMode" ] [ "services" "kubo" "defaultMode" ])
(mkRenamedOptionModule [ "services" "ipfs" "autoMount" ] [ "services" "kubo" "autoMount" ])
(mkRenamedOptionModule [ "services" "ipfs" "autoMigrate" ] [ "services" "kubo" "autoMigrate" ])
(mkRenamedOptionModule [ "services" "ipfs" "ipfsMountDir" ] [ "services" "kubo" "ipfsMountDir" ])
(mkRenamedOptionModule [ "services" "ipfs" "ipnsMountDir" ] [ "services" "kubo" "ipnsMountDir" ])
(mkRenamedOptionModule [ "services" "ipfs" "gatewayAddress" ] [ "services" "kubo" "gatewayAddress" ])
(mkRenamedOptionModule [ "services" "ipfs" "apiAddress" ] [ "services" "kubo" "apiAddress" ])
(mkRenamedOptionModule [ "services" "ipfs" "swarmAddress" ] [ "services" "kubo" "swarmAddress" ])
(mkRenamedOptionModule [ "services" "ipfs" "enableGC" ] [ "services" "kubo" "enableGC" ])
(mkRenamedOptionModule [ "services" "ipfs" "emptyRepo" ] [ "services" "kubo" "emptyRepo" ])
(mkRenamedOptionModule [ "services" "ipfs" "extraConfig" ] [ "services" "kubo" "extraConfig" ])
(mkRenamedOptionModule [ "services" "ipfs" "extraFlags" ] [ "services" "kubo" "extraFlags" ])
(mkRenamedOptionModule [ "services" "ipfs" "localDiscovery" ] [ "services" "kubo" "localDiscovery" ])
(mkRenamedOptionModule [ "services" "ipfs" "serviceFdlimit" ] [ "services" "kubo" "serviceFdlimit" ])
(mkRenamedOptionModule [ "services" "ipfs" "startWhenNeeded" ] [ "services" "kubo" "startWhenNeeded" ])
];
}
2 changes: 1 addition & 1 deletion nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ in {
installer-systemd-stage-1 = handleTest ./installer-systemd-stage-1.nix {};
invoiceplane = handleTest ./invoiceplane.nix {};
iodine = handleTest ./iodine.nix {};
ipfs = handleTest ./ipfs.nix {};
ipv6 = handleTest ./ipv6.nix {};
iscsi-multipath-root = handleTest ./iscsi-multipath-root.nix {};
iscsi-root = handleTest ./iscsi-root.nix {};
Expand Down Expand Up @@ -317,6 +316,7 @@ in {
ksm = handleTest ./ksm.nix {};
kthxbye = handleTest ./kthxbye.nix {};
kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {};
kubo = handleTest ./kubo.nix {};
ladybird = handleTest ./ladybird.nix {};
languagetool = handleTest ./languagetool.nix {};
latestKernel.login = handleTest ./login.nix { latestKernel = true; };
Expand Down
6 changes: 3 additions & 3 deletions nixos/tests/ipfs.nix → nixos/tests/kubo.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "ipfs";
name = "kubo";
meta = with pkgs.lib.maintainers; {
maintainers = [ mguentner ];
};

nodes.machine = { ... }: {
services.ipfs = {
services.kubo = {
enable = true;
# Also will add a unix domain socket socket API address, see module.
startWhenNeeded = true;
Expand All @@ -15,7 +15,7 @@ import ./make-test-python.nix ({ pkgs, ...} : {
};

nodes.fuse = { ... }: {
services.ipfs = {
services.kubo = {
enable = true;
apiAddress = "/ip4/127.0.0.1/tcp/2324";
autoMount = true;
Expand Down
23 changes: 0 additions & 23 deletions pkgs/applications/networking/ipfs-migrator/default.nix

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
, stdenv
, symlinkJoin
, buildGoModule
, ipfs-migrator-unwrapped
, kubo-migrator-unwrapped
}:

# This package contains all the individual migrations in the bin directory.
# This is used by fs-repo-migrations and could also be used by IPFS itself
# This is used by fs-repo-migrations and could also be used by Kubo itself
# when starting it like this: ipfs daemon --migrate

let
fs-repo-common = pname: version: buildGoModule {
inherit pname version;
inherit (ipfs-migrator-unwrapped) src;
inherit (kubo-migrator-unwrapped) src;
sourceRoot = "source/${pname}";
vendorSha256 = null;
doCheck = false;
meta = ipfs-migrator-unwrapped.meta // {
meta = kubo-migrator-unwrapped.meta // {
mainProgram = pname;
description = "Individual migration for the filesystem repository of ipfs clients";
description = "Individual migration for the filesystem repository of Kubo clients";
};
};

Expand Down Expand Up @@ -58,6 +58,6 @@ let
in

symlinkJoin {
name = "ipfs-migrator-all-fs-repo-migrations-${version}";
name = "kubo-migrator-all-fs-repo-migrations-${version}";
paths = all-migrations;
}
23 changes: 23 additions & 0 deletions pkgs/applications/networking/kubo-migrator/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ lib
, buildEnv
, makeWrapper
, kubo-migrator-unwrapped
, kubo-migrator-all-fs-repo-migrations
}:

buildEnv {
name = "kubo-migrator-${kubo-migrator-unwrapped.version}";

nativeBuildInputs = [ makeWrapper ];

paths = [ kubo-migrator-unwrapped ];

pathsToLink = [ "/bin" ];

postBuild = ''
wrapProgram "$out/bin/fs-repo-migrations" \
--prefix PATH ':' '${lib.makeBinPath [ kubo-migrator-all-fs-repo-migrations ]}'
'';

inherit (kubo-migrator-unwrapped) meta;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}:

buildGoModule rec {
pname = "ipfs-migrator";
pname = "kubo-migrator";
version = "2.0.2";

src = fetchFromGitHub {
Expand All @@ -26,7 +26,7 @@ buildGoModule rec {
doCheck = false;

meta = with lib; {
description = "Migrations for the filesystem repository of ipfs clients";
description = "Migrations for the filesystem repository of Kubo clients";
homepage = "https://github.com/ipfs/fs-repo-migrations";
license = licenses.mit;
maintainers = with maintainers; [ Luflosi elitak ];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{ lib, buildGoModule, fetchurl, nixosTests, openssl, pkg-config }:

buildGoModule rec {
pname = "ipfs";
pname = "kubo";
version = "0.15.0"; # When updating, also check if the repo version changed and adjust repoVersion below
rev = "v${version}";

passthru.repoVersion = "12"; # Also update ipfs-migrator when changing the repo version
passthru.repoVersion = "12"; # 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 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";
hash = "sha256-GkOY1G2CKXbMbHXkw5v27HmfkJIl2nZOmjjZbzuaRWs=";
};

# 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
'';

sourceRoot = ".";
Expand All @@ -29,7 +29,7 @@ buildGoModule rec {
nativeBuildInputs = [ pkg-config ];
tags = [ "openssl" ];

passthru.tests.ipfs = nixosTests.ipfs;
passthru.tests.kubo = nixosTests.kubo;

vendorSha256 = null;

Expand Down Expand Up @@ -57,6 +57,7 @@ buildGoModule rec {
homepage = "https://ipfs.io/";
license = licenses.mit;
platforms = platforms.unix;
mainProgram = "ipfs";
maintainers = with maintainers; [ fpletz ];
};
}
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/ipfshttpclient/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
, pytest-order
, pytest-cid
, mock
, ipfs
, kubo
, httpx
, httpcore
}:
Expand Down Expand Up @@ -46,7 +46,7 @@ buildPythonPackage rec {
pytest-order
pytest-cid
mock
ipfs
kubo
httpcore
httpx
];
Expand Down
Loading