nextcloudXXPackages.apps.recognize: suport nextcloud 29 and 28

This commit is contained in:
Beardhatcode 2024-12-09 13:52:56 +01:00
parent ed5608b888
commit 0479e6ee96
3 changed files with 36 additions and 6 deletions

View File

@ -9,23 +9,48 @@
# Current derivation only suports linux-x86_64 (contributions welcome, without libTensorflow builtin webassembly can be used)
useLibTensorflow ? stdenv.isx86_64 && stdenv.isLinux,
ncVersion,
}:
let
latestVersionForNc = {
"30" = {
version = "8.2.0";
appHash = "sha256-CAORqBdxNQ0x+xIVY2zI07jvsKHaa7eH0jpVuP0eSW4=";
modelHash = "sha256-s8MQOLU490/Vr/U4GaGlbdrykOAQOKeWE5+tCzn6Dew=";
};
"29" = {
version = "7.1.0";
appHash = "sha256-qR4SrTHFAc4YWiZAsL94XcH4VZqYtkRLa0y+NdiFZus=";
modelHash = "sha256-M/j5wVOBLR7xMVJQWDUWAzLajRUBYEzHSNBsRSBUgfM=";
};
"28" = {
# Once this version is no longer supported, we can remove the getAppValue replacements below
# The getAppValueString stuff will need to remain
version = "6.1.0";
appHash = "sha256-225r2JnDOoURvLmzpmHp/QL6GDx9124/YTywbxH3/rk=";
modelHash = "sha256-4mhQM/ajpwjqTb8jSbEIdtSRrWZEOaMZQXAwcfSRQ/M=";
};
};
currentVersionInfo = latestVersionForNc.${ncVersion};
in
stdenv.mkDerivation rec {
pname = "nextcloud-app-recognise";
version = "8.2.0";
version = currentVersionInfo.version;
srcs =
[
(fetchurl {
inherit version;
url = "https://github.com/nextcloud/recognize/releases/download/v${version}/recognize-${version}.tar.gz";
hash = "sha256-CAORqBdxNQ0x+xIVY2zI07jvsKHaa7eH0jpVuP0eSW4=";
hash = currentVersionInfo.appHash;
})
(fetchurl {
inherit version;
url = "https://github.com/nextcloud/recognize/archive/refs/tags/v${version}.tar.gz";
hash = "sha256-s8MQOLU490/Vr/U4GaGlbdrykOAQOKeWE5+tCzn6Dew=";
hash = currentVersionInfo.modelHash;
})
]
++ lib.optionals useLibTensorflow [
@ -57,7 +82,9 @@ stdenv.mkDerivation rec {
substituteInPlace recognize/lib/**/*.php \
--replace-quiet "\$this->settingsService->getSetting('node_binary')" "'${nodejs}/bin/node'" \
--replace-quiet "\$this->config->getAppValueString('node_binary', '""')" "'${nodejs}/bin/node'" \
--replace-quiet "\$this->config->getAppValueString('node_binary')" "'${nodejs}/bin/node'"
--replace-quiet "\$this->config->getAppValueString('node_binary')" "'${nodejs}/bin/node'" \
--replace-quiet "\$this->config->getAppValue('node_binary', '""')" "'${nodejs}/bin/node'" \
--replace-quiet "\$this->config->getAppValue('node_binary')" "'${nodejs}/bin/node'"
test "$(grep "get[a-zA-Z]*('node_binary'" recognize/lib/**/*.php | wc -l)" -eq 0

View File

@ -55,4 +55,6 @@ let
) generatedJson;
in
(lib.makeExtensible (_: (lib.makeScope newScope packages))).extend (import ./thirdparty.nix)
(lib.makeExtensible (_: (lib.makeScope newScope packages))).extend (
import ./thirdparty.nix { inherit ncVersion; }
)

View File

@ -1,3 +1,4 @@
{ ncVersion }:
_:
{ apps, callPackage, ... }:
{
@ -6,7 +7,7 @@ _:
self: super: {
hmr_enabler = callPackage ./apps/hmr_enabler.nix { };
recognize = callPackage ./apps/recognize.nix { };
recognize = callPackage ./apps/recognize.nix { inherit ncVersion; };
}
);