mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
[Backport release-25.05] anytype: add custom update script (#441753)
This commit is contained in:
@@ -10,17 +10,6 @@
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "anytype-heart";
|
||||
# Use only versions specified in anytype-ts middleware.version file:
|
||||
# https://github.com/anyproto/anytype-ts/blob/v<anytype-ts-version>/middleware.version
|
||||
version = "0.43.0-rc02";
|
||||
src = fetchFromGitHub {
|
||||
owner = "anyproto";
|
||||
repo = "anytype-heart";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-hqDwzW1Tl44ipL1EAwlXUoKaQ0Wvfa2rtZMQy4pgQ8k=";
|
||||
};
|
||||
|
||||
arch =
|
||||
{
|
||||
# https://github.com/anyproto/anytype-heart/blob/f33a6b09e9e4e597f8ddf845fc4d6fe2ef335622/pkg/lib/localstore/ftsearch/ftsearchtantivy.go#L3
|
||||
@@ -31,10 +20,20 @@ let
|
||||
}
|
||||
.${stdenv.hostPlatform.system}
|
||||
or (throw "anytype-heart not supported on ${stdenv.hostPlatform.system}");
|
||||
|
||||
in
|
||||
buildGoModule {
|
||||
inherit pname version src;
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "anytype-heart";
|
||||
|
||||
# Use only versions specified in anytype-ts middleware.version file:
|
||||
# https://github.com/anyproto/anytype-ts/blob/v<anytype-ts-version>/middleware.version
|
||||
version = "0.43.0-rc02";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "anyproto";
|
||||
repo = "anytype-heart";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-hqDwzW1Tl44ipL1EAwlXUoKaQ0Wvfa2rtZMQy4pgQ8k=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-Rs+CusvMksyXUplGk09J4CiFgl/D4KtsI9C15dSCjOI=";
|
||||
|
||||
@@ -83,10 +82,12 @@ buildGoModule {
|
||||
meta = {
|
||||
description = "Shared library for Anytype clients";
|
||||
homepage = "https://anytype.io/";
|
||||
changelog = "https://github.com/anyproto/anytype-heart/releases/tag/${finalAttrs.src.tag}";
|
||||
license = lib.licenses.unfreeRedistributable;
|
||||
maintainers = with lib.maintainers; [
|
||||
autrimpo
|
||||
adda
|
||||
kira-bruneau
|
||||
];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
@@ -95,4 +96,4 @@ buildGoModule {
|
||||
"aarch64-darwin"
|
||||
];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,17 +12,16 @@
|
||||
commandLineArgs ? "",
|
||||
}:
|
||||
|
||||
let
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "anytype";
|
||||
version = "0.49.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "anyproto";
|
||||
repo = "anytype-ts";
|
||||
tag = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-8+x2FmyR5x9Zrm3t71RSyxAKcJCvnR98+fqHXjBE7aU=";
|
||||
};
|
||||
description = "P2P note-taking tool";
|
||||
|
||||
locales = fetchFromGitHub {
|
||||
owner = "anyproto";
|
||||
@@ -30,9 +29,6 @@ let
|
||||
rev = "873b42df7320ebbbc80d7e2477914dac70363ef7";
|
||||
hash = "sha256-Mr0KfXn9NO86QqgBhVjSs2przN/GtjuhJHJ9djo8Feg=";
|
||||
};
|
||||
in
|
||||
buildNpmPackage {
|
||||
inherit pname version src;
|
||||
|
||||
npmDepsHash = "sha256-fuNTSZl+4DG/YL34f/+bYK26ruRFAc1hyHVAm256LiE=";
|
||||
|
||||
@@ -62,7 +58,7 @@ buildNpmPackage {
|
||||
cp -r ${anytype-heart}/lib dist/
|
||||
cp -r ${anytype-heart}/bin/anytypeHelper dist/
|
||||
|
||||
for lang in ${locales}/locales/*; do
|
||||
for lang in ${finalAttrs.locales}/locales/*; do
|
||||
cp "$lang" "dist/lib/json/lang/$(basename $lang)"
|
||||
done
|
||||
|
||||
@@ -106,7 +102,7 @@ buildNpmPackage {
|
||||
exec = "anytype %U";
|
||||
icon = "anytype";
|
||||
desktopName = "Anytype";
|
||||
comment = description;
|
||||
comment = finalAttrs.meta.description;
|
||||
mimeTypes = [ "x-scheme-handler/anytype" ];
|
||||
categories = [
|
||||
"Utility"
|
||||
@@ -118,15 +114,21 @@ buildNpmPackage {
|
||||
})
|
||||
];
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = {
|
||||
inherit description;
|
||||
description = "P2P note-taking tool";
|
||||
homepage = "https://anytype.io/";
|
||||
changelog = "https://community.anytype.io/t/anytype-desktop-${
|
||||
builtins.replaceStrings [ "." ] [ "-" ] (lib.versions.majorMinor finalAttrs.version)
|
||||
}-0-released";
|
||||
license = lib.licenses.unfreeRedistributable;
|
||||
mainProgram = "anytype";
|
||||
maintainers = with lib.maintainers; [
|
||||
running-grass
|
||||
autrimpo
|
||||
adda
|
||||
kira-bruneau
|
||||
];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
@@ -136,4 +138,4 @@ buildNpmPackage {
|
||||
];
|
||||
broken = stdenv.hostPlatform.isDarwin;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
61
pkgs/by-name/an/anytype/update.sh
Executable file
61
pkgs/by-name/an/anytype/update.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p common-updater-scripts coreutils curl jq nix-update
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
anytype_version=null
|
||||
release_page=1
|
||||
|
||||
# Anytype often has many pre-releases between releases, which can span multiple pages
|
||||
while [ "$anytype_version" = 'null' ]; do
|
||||
readarray -t release < <(
|
||||
curl "https://api.github.com/repos/anyproto/anytype-ts/releases?page=$release_page" \
|
||||
${GITHUB_TOKEN:+--user ":$GITHUB_TOKEN"} \
|
||||
--silent \
|
||||
| jq --raw-output '
|
||||
map(select(
|
||||
(.prerelease == false) and
|
||||
(.tag_name | test("alpha|beta") | not)
|
||||
)) | .[0] | .tag_name, .created_at
|
||||
'
|
||||
)
|
||||
anytype_version=${release[0]//v}
|
||||
anytype_release_date=${release[1]}
|
||||
release_page=$((release_page+1))
|
||||
done
|
||||
|
||||
if [ "$UPDATE_NIX_OLD_VERSION" = "$anytype_version" ]; then
|
||||
echo "Already up to date!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# https://github.com/anyproto/anytype-ts/blob/v0.49.2/electron/hook/locale.js
|
||||
locales_rev=$(
|
||||
curl "https://api.github.com/repos/anyproto/l10n-anytype-ts/commits?until=$anytype_release_date&per_page=1" \
|
||||
${GITHUB_TOKEN:+--user ":$GITHUB_TOKEN"} \
|
||||
--silent \
|
||||
| jq --raw-output '.[0].sha'
|
||||
)
|
||||
|
||||
# https://github.com/anyproto/anytype-ts/blob/v0.49.2/update.sh
|
||||
middleware_version=$(
|
||||
curl "https://raw.githubusercontent.com/anyproto/anytype-ts/refs/tags/v$anytype_version/middleware.version" \
|
||||
${GITHUB_TOKEN:+--user ":$GITHUB_TOKEN"} \
|
||||
--silent
|
||||
)
|
||||
|
||||
# https://github.com/anyproto/anytype-heart/blob/v0.42.4/makefiles/vars.mk#L8
|
||||
tantivy_go_version=$(
|
||||
curl "https://raw.githubusercontent.com/anyproto/anytype-heart/refs/tags/v$middleware_version/go.mod" \
|
||||
${GITHUB_TOKEN:+--user ":$GITHUB_TOKEN"} \
|
||||
--silent \
|
||||
| grep github.com/anyproto/tantivy-go \
|
||||
| cut --delimiter=' ' --field=2
|
||||
)
|
||||
|
||||
tantivy_go_version=${tantivy_go_version//v}
|
||||
|
||||
nix-update tantivy-go --version "$tantivy_go_version" --generate-lockfile
|
||||
nix-update anytype-heart --version "$middleware_version"
|
||||
update-source-version anytype --ignore-same-version --source-key=locales --rev="$locales_rev"
|
||||
nix-update anytype --version "$anytype_version"
|
||||
1908
pkgs/by-name/ta/tantivy-go/Cargo.lock
generated
Normal file
1908
pkgs/by-name/ta/tantivy-go/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4,33 +4,42 @@
|
||||
rustPlatform,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "tantivy-go";
|
||||
version = "1.0.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "anyproto";
|
||||
repo = "tantivy-go";
|
||||
tag = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-ksHw+62JwQrzxLuXwYfTLOkC22Miz1Rpl5XX8+vPBcM=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-GKbQFWXKEgYmoTyFCQ/SAgFB7UJpYN2SWwZEiUxd260=";
|
||||
sourceRoot = "${finalAttrs.src.name}/rust";
|
||||
|
||||
cargoPatches = [
|
||||
./add-Cargo.lock.patch
|
||||
];
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"rust-stemmers-1.2.0" = "sha256-GJYFQf025U42rJEoI9eIi3xDdK6enptAr3jphuKJdiw=";
|
||||
"tantivy-0.23.0" = "sha256-e2ffM2gRC5eww3xv9izLqukGUgduCt2u7jsqTDX5l8k=";
|
||||
"tantivy-jieba-0.11.0" = "sha256-BDz6+EVksgLkOj/8XXxPMVshI0X1+oLt6alDLMpnLZc=";
|
||||
};
|
||||
};
|
||||
|
||||
cargoRoot = "rust";
|
||||
buildAndTestSubdir = cargoRoot;
|
||||
postPatch = ''
|
||||
ln -s ${./Cargo.lock} Cargo.lock
|
||||
chmod +w ../bindings.h
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Tantivy go bindings";
|
||||
homepage = "https://github.com/anyproto/tantivy-go";
|
||||
changelog = "https://github.com/anyproto/tantivy-go/releases/tag/${finalAttrs.src.tag}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [
|
||||
autrimpo
|
||||
adda
|
||||
kira-bruneau
|
||||
];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user