Merge pull request #29942 from elitak/ipfs

Ipfs: prepare for autoMigrate fix

Changed files
+106 -2
nixos
modules
services
network-filesystems
pkgs
applications
networking
top-level
+9 -2
nixos/modules/services/network-filesystems/ipfs.nix
···
ipfsFlags = toString ([
(optionalString cfg.autoMount "--mount")
-
(optionalString cfg.autoMigrate "--migrate")
+
#(optionalString cfg.autoMigrate "--migrate")
(optionalString cfg.enableGC "--enable-gc")
(optionalString (cfg.serviceFdlimit != null) "--manage-fdlimit=false")
(optionalString (cfg.defaultMode == "offline") "--offline")
···
baseService = recursiveUpdate commonEnv {
wants = [ "ipfs-init.service" ];
+
# NB: migration must be performed prior to pre-start, else we get the failure message!
preStart = ''
ipfs repo fsck # workaround for BUG #4212 (https://github.com/ipfs/go-ipfs/issues/4214)
ipfs --local config Addresses.API ${cfg.apiAddress}
···
description = "systemd service that is enabled by default";
};
+
/*
autoMigrate = mkOption {
type = types.bool;
default = false;
-
description = "Whether IPFS should try to migrate the file system automatically";
+
description = ''
+
Whether IPFS should try to migrate the file system automatically.
+
+
The daemon will need to be able to download a binary from https://ipfs.io to perform the migration.
+
'';
};
+
*/
autoMount = mkOption {
type = types.bool;
+27
pkgs/applications/networking/ipfs-migrator/default.nix
···
+
{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+
buildGoPackage rec {
+
name = "ipfs-migrator-${version}";
+
version = "6";
+
+
goPackagePath = "github.com/ipfs/fs-repo-migrations";
+
+
goDeps = ./deps.nix;
+
+
src = fetchFromGitHub {
+
owner = "ipfs";
+
repo = "fs-repo-migrations";
+
rev = "a89e9769b9cac25ad9ca31c7e9a4445c7966d35b";
+
sha256 = "0x4mbkx7wlqjmkg6852hljq947v9y9k3hjd5yfj7kka1hpvxd7bn";
+
};
+
+
patches = [ ./lru-repo-path-fix.patch ];
+
+
meta = with stdenv.lib; {
+
description = "Migration tool for ipfs repositories";
+
homepage = https://ipfs.io/;
+
license = licenses.mit;
+
platforms = platforms.unix;
+
maintainers = with maintainers; [ elitak ];
+
};
+
}
+56
pkgs/applications/networking/ipfs-migrator/deps.nix
···
+
[
+
{
+
goPackagePath = "github.com/dustin/go-humanize";
+
fetch = {
+
type = "git";
+
url = https://github.com/dustin/go-humanize;
+
rev = "79e699ccd02f240a1f1fbbdcee7e64c1c12e41aa";
+
sha256 = "0awfqszgjw8qrdw31v74jnvj1jbp7czhd8aq59j57yyj4hy50fzj";
+
};
+
}
+
{
+
goPackagePath = "github.com/jbenet/goprocess";
+
fetch = {
+
type = "git";
+
url = https://github.com/jbenet/goprocess;
+
rev = "b497e2f366b8624394fb2e89c10ab607bebdde0b";
+
sha256 = "1lnvkzki7vnqn5c4m6bigk0k85haicmg27w903kwg30rdvblm82s";
+
};
+
}
+
{
+
goPackagePath = "github.com/jbenet/go-random";
+
fetch = {
+
type = "git";
+
url = https://github.com/jbenet/go-random;
+
rev = "384f606e91f542a98e779e652eed88051618f0f7";
+
sha256 = "0gcshzl9n3apzc0jaxqrjsc038yfrzfyhpdqgbpcnajin83l2msa";
+
};
+
}
+
{
+
goPackagePath = "github.com/jbenet/go-random-files";
+
fetch = {
+
type = "git";
+
url = https://github.com/jbenet/go-random-files;
+
rev = "737479700b40b4b50e914e963ce8d9d44603e3c8";
+
sha256 = "1klpdc4qkrfy31r7qh00fcz42blswzabmcnry9byd5adhszxj9bw";
+
};
+
}
+
{
+
goPackagePath = "github.com/hashicorp/golang-lru";
+
fetch = {
+
type = "git";
+
url = https://github.com/hashicorp/golang-lru;
+
rev = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6";
+
sha256 = "1iq7lbpsz7ks052mpznmkf8s4k43p51z4dik2n9ivrxk666q2wxi";
+
};
+
}
+
{
+
goPackagePath = "golang.org/x/net";
+
fetch = {
+
type = "git";
+
url = "https://go.googlesource.com/net";
+
rev = "71a035914f99bb58fe82eac0f1289f10963d876c";
+
sha256 = "06m16c9vkwc8m2mcxcxa7p8mb26ikc810lgzd5m8k1r6lp3hc8wm";
+
};
+
}
+
]
+13
pkgs/applications/networking/ipfs-migrator/lru-repo-path-fix.patch
···
+
diff --git a/ipfs-1-to-2/go-datastore/lru/datastore.go b/ipfs-1-to-2/go-datastore/lru/datastore.go
+
index 7eb18eb..cd8dcb7 100644
+
--- a/ipfs-1-to-2/go-datastore/lru/datastore.go
+
+++ b/ipfs-1-to-2/go-datastore/lru/datastore.go
+
@@ -3,7 +3,7 @@ package lru
+
import (
+
"errors"
+
+
- lru "github.com/ipfs/fs-repo-migrations/ipfs-1-to-2/golang-lru"
+
+ lru "github.com/hashicorp/golang-lru"
+
+
ds "github.com/ipfs/fs-repo-migrations/ipfs-1-to-2/go-datastore"
+
dsq "github.com/ipfs/fs-repo-migrations/ipfs-1-to-2/go-datastore/query"
+1
pkgs/top-level/all-packages.nix
···
iperf = iperf3;
ipfs = callPackage ../applications/networking/ipfs { };
+
ipfs-migrator = callPackage ../applications/networking/ipfs-migrator { };
ipmitool = callPackage ../tools/system/ipmitool {
static = false;