Skip to content

Commit

Permalink
kubo-migrator: rewrite
Browse files Browse the repository at this point in the history
- Migrate to pkgs/by-name
- Format with nixfmt-rfc-style
- Make it possible to remove support for very old migrations in the future by increasing the `minRepoVersion` parameter
- Rename kubo-migrator-all-fs-repo-migrations to kubo-fs-repo-migrations since it may no longer include all migrations
- Add an alias for kubo-migrator-all-fs-repo-migrations to keep backwards compatibility
- Update descriptions to differentiate between kubo-migrator and kubo-migrator-unwrapped and better describe the purpose of the migrator
- Add a description to every individual migration
- Add a description to kubo-fs-repo-migrations
- Fetch the source code of the individual migrations from their specific Git tags, like upstream intends
- Enable tests for some migrations
- Check that the migrations don't crash on startup
- Mark two broken migrations as broken. They are not compatible with the latest Go versions and upstream is not interested in fixing this
- Change code to allow most updates to be done by only changing three lines (add new version and change git tag and hash)
- Add a stub for any disabled or broken migration to prevent downloading unsigned binaries from the internet, see ipfs/fs-repo-migrations#148 (comment) and ipfs/fs-repo-migrations#188
- Use `lib.getExe` instead of hardcoding the binary name in the kubo NixOS module
- Use `substituteInPlace` with `--replace-fail` instead of `--replace`
  • Loading branch information
Luflosi committed Oct 26, 2024
1 parent 8195804 commit d414dfb
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 147 deletions.
2 changes: 1 addition & 1 deletion nixos/modules/services/network-filesystems/kubo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,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"
'' + lib.optionalString cfg.autoMigrate ''
${pkgs.kubo-migrator}/bin/fs-repo-migrations -to '${cfg.package.repoVersion}' -y
'${lib.getExe pkgs.kubo-migrator}' -to '${cfg.package.repoVersion}' -y
'' + ''
fi
ipfs --offline config show |
Expand Down
82 changes: 0 additions & 82 deletions pkgs/applications/networking/kubo-migrator/all-migrations.nix

This file was deleted.

23 changes: 0 additions & 23 deletions pkgs/applications/networking/kubo-migrator/default.nix

This file was deleted.

35 changes: 0 additions & 35 deletions pkgs/applications/networking/kubo-migrator/unwrapped.nix

This file was deleted.

Loading

0 comments on commit d414dfb

Please sign in to comment.