Skip to content

Commit

Permalink
kubo-migrator: fix broken migrations
Browse files Browse the repository at this point in the history
Two old migrations were broken since Go 1.16 was removed from Nixpkgs.
Upstream is not interested in fixing the migrations to work with newer Go versions: ipfs/fs-repo-migrations#163 (comment).
  • Loading branch information
Luflosi committed Jan 24, 2023
1 parent eb95aa0 commit 5ea0dce
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let
fs-repo-common = pname: version: buildGoModule {
inherit pname version;
inherit (kubo-migrator-unwrapped) src;
sourceRoot = "source/${pname}";
sourceRoot = "kubo-migrator-src/${pname}";
vendorSha256 = null;
doCheck = false;
meta = kubo-migrator-unwrapped.meta // {
Expand Down
42 changes: 42 additions & 0 deletions pkgs/applications/networking/kubo-migrator/src.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ lib
, stdenvNoCC
, fetchFromGitHub
, fetchpatch
}:

stdenvNoCC.mkDerivation rec {
name = "kubo-migrator-src";

src = fetchFromGitHub {
owner = "ipfs";
repo = "fs-repo-migrations";
rev = "fs-repo-11-to-12/v1.0.2";
hash = "sha256-CG4utwH+/+Igw+SP3imhl39wijlB53UGtkJG5Mwh+Ik=";
};

patches = [
# Make the migrations compatible with Go 1.17 and newer
(fetchpatch {
name = "fix-fs-repo-10-to-11.patch";
url = "https://github.com/ipfs/fs-repo-migrations/pull/163/commits/c3b39a3ccd51e65e1039652235cb6930d3304a08.patch";
hash = "sha256-YkFtFsYueCd24WsRINq7Q5wvFjoIVAqlN9yy9y6kNrw=";
})
(fetchpatch {
name = "fix-fs-repo-11-to-12.patch";
url = "https://github.com/ipfs/fs-repo-migrations/pull/163/commits/408f58ffdf9869bcb51cd4d8d99d5aefd65df593.patch";
hash = "sha256-IkRkwNVDLSU8wWmtFuxM5H0g6Jkkso/i8k5XmjMrLA8=";
})
];

dontConfigure = true;
dontBuild = true;
doCheck = false;
dontFixup = true;

installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r * .* "$out"
runHook postInstall
'';
}
18 changes: 4 additions & 14 deletions pkgs/applications/networking/kubo-migrator/unwrapped.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
{ lib
, buildGoModule
, fetchFromGitHub
, callPackage
}:

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

src = fetchFromGitHub {
owner = "ipfs";
repo = "fs-repo-migrations";
# Use the latest git tag here, since v2.0.2 does not
# contain the latest migration fs-repo-11-to-12/v1.0.2
# The fs-repo-migrations code itself is the same between
# the two versions but the migration code, which is built
# into separate binaries, is not.
rev = "fs-repo-11-to-12/v1.0.2";
sha256 = "sha256-CG4utwH+/+Igw+SP3imhl39wijlB53UGtkJG5Mwh+Ik=";
};
src = callPackage ./src.nix { };

sourceRoot = "source/fs-repo-migrations";
sourceRoot = "kubo-migrator-src/fs-repo-migrations";

vendorSha256 = "sha256-/DqkBBtR/nU8gk3TFqNKY5zQU6BFMc3N8Ti+38mi/jk=";
vendorHash = "sha256-/DqkBBtR/nU8gk3TFqNKY5zQU6BFMc3N8Ti+38mi/jk=";

doCheck = false;

Expand Down

0 comments on commit 5ea0dce

Please sign in to comment.