anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / networking / kubo-migrator / all-migrations.nix
blobd44fafb3be9e9456534f5d68c2e1b7759582a261
1 { lib
2 , stdenv
3 , symlinkJoin
4 , buildGoModule
5 , kubo-migrator-unwrapped
6 }:
8 # This package contains all the individual migrations in the bin directory.
9 # This is used by fs-repo-migrations and could also be used by Kubo itself
10 # when starting it like this: ipfs daemon --migrate
12 let
13   fs-repo-common = pname: version: buildGoModule {
14     inherit pname version;
15     inherit (kubo-migrator-unwrapped) src;
16     sourceRoot = "${kubo-migrator-unwrapped.src.name}/${pname}";
17     vendorHash = null;
18     # Fix build on Go 1.17 and later: panic: qtls.ClientHelloInfo doesn't match
19     # See https://github.com/ipfs/fs-repo-migrations/pull/163
20     postPatch = lib.optionalString (lib.elem pname [ "fs-repo-10-to-11" "fs-repo-11-to-12" ]) ''
21       substituteInPlace 'vendor/github.com/marten-seemann/qtls-go1-15/common.go' \
22         --replace \
23           '"container/list"' \
24           '"container/list"
25           "context"' \
26         --replace \
27           'config *Config' \
28           'config *Config
29           ctx context.Context'
30     '';
31     doCheck = false;
32     meta = kubo-migrator-unwrapped.meta // {
33       mainProgram = pname;
34       description = "Individual migration for the filesystem repository of Kubo clients";
35     };
36   };
38   # Concatenation of the latest repo version and the version of that migration
39   version = "15.1.0.1";
41   fs-repo-14-to-15 = fs-repo-common "fs-repo-14-to-15" "1.0.1";
42   fs-repo-13-to-14 = fs-repo-common "fs-repo-13-to-14" "1.0.0";
43   fs-repo-12-to-13 = fs-repo-common "fs-repo-12-to-13" "1.0.0";
44   fs-repo-11-to-12 = fs-repo-common "fs-repo-11-to-12" "1.0.2";
45   fs-repo-10-to-11 = fs-repo-common "fs-repo-10-to-11" "1.0.1";
46   fs-repo-9-to-10  = fs-repo-common "fs-repo-9-to-10"  "1.0.1";
47   fs-repo-8-to-9   = fs-repo-common "fs-repo-8-to-9"   "1.0.1";
48   fs-repo-7-to-8   = fs-repo-common "fs-repo-7-to-8"   "1.0.1";
49   fs-repo-6-to-7   = fs-repo-common "fs-repo-6-to-7"   "1.0.1";
50   fs-repo-5-to-6   = fs-repo-common "fs-repo-5-to-6"   "1.0.1";
51   fs-repo-4-to-5   = fs-repo-common "fs-repo-4-to-5"   "1.0.1";
52   fs-repo-3-to-4   = fs-repo-common "fs-repo-3-to-4"   "1.0.1";
53   fs-repo-2-to-3   = fs-repo-common "fs-repo-2-to-3"   "1.0.1";
54   fs-repo-1-to-2   = fs-repo-common "fs-repo-1-to-2"   "1.0.1";
55   fs-repo-0-to-1   = fs-repo-common "fs-repo-0-to-1"   "1.0.1";
57   all-migrations = [
58     fs-repo-14-to-15
59     fs-repo-13-to-14
60     fs-repo-12-to-13
61     fs-repo-11-to-12
62     fs-repo-10-to-11
63     fs-repo-9-to-10
64     fs-repo-8-to-9
65     fs-repo-7-to-8
66   ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) # I didn't manage to fix this on macOS:
67     fs-repo-6-to-7                     # gx/ipfs/QmSGRM5Udmy1jsFBr1Cawez7Lt7LZ3ZKA23GGVEsiEW6F3/eventfd/eventfd.go:27:32: undefined: syscall.SYS_EVENTFD2
68   ++ [
69     fs-repo-5-to-6
70     fs-repo-4-to-5
71     fs-repo-3-to-4
72     fs-repo-2-to-3
73     fs-repo-1-to-2
74     fs-repo-0-to-1
75   ];
79 symlinkJoin {
80   name = "kubo-migrator-all-fs-repo-migrations-${version}";
81   paths = all-migrations;