nextcloud31Packages.apps.memories: package by hand to remove pre-compiled binaries

This commit is contained in:
Sandro Jäckel
2025-03-07 22:13:18 +01:00
parent 3283056c2b
commit 2bd9e401fd
6 changed files with 126 additions and 23 deletions
-10
View File
@@ -219,16 +219,6 @@
"agpl"
]
},
"memories": {
"hash": "sha256-BfxJDCGsiRJrZWkNJSQF3rSFm/G3zzQn7C6DCETSzw4=",
"url": "https://github.com/pulsejet/memories/releases/download/v7.5.2/memories.tar.gz",
"version": "7.5.2",
"description": "# Memories: Photo Management for Nextcloud\n\nMemories is a *batteries-included* photo management solution for Nextcloud with advanced features including:\n\n- **📸 Timeline**: Sort photos and videos by date taken, parsed from Exif data.\n- **⏪ Rewind**: Jump to any time in the past instantly and relive your memories.\n- **🤖 AI Tagging**: Group photos by people and objects, powered by [recognize](https://github.com/nextcloud/recognize) and [facerecognition](https://github.com/matiasdelellis/facerecognition).\n- **🖼️ Albums**: Create albums to group photos and videos together. Then share these albums with others.\n- **🫱🏻‍🫲🏻 External Sharing**: Share photos and videos with people outside of your Nextcloud instance.\n- **📱 Mobile Support**: Work from any device, of any shape and size through the web app.\n- **✏️ Edit Metadata**: Edit dates and other metadata on photos quickly and in bulk.\n- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder.\n- **📹 Video Transcoding**: Transcode videos and use HLS for maximal performance.\n- **🗺️ Map**: View your photos on a map, tagged with accurate reverse geocoding.\n- **📦 Migration**: Migrate easily from Nextcloud Photos and Google Takeout.\n- **⚡️ Performance**: Do all this very fast.\n\n## 🚀 Installation\n\n1. Install the app from the Nextcloud app store (try a demo [here](https://demo.memories.gallery/apps/memories/)).\n1. Perform the recommended [configuration steps](https://memories.gallery/config/).\n1. Run `php occ memories:index` to generate metadata indices for existing photos.\n1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos.",
"homepage": "https://memories.gallery",
"licenses": [
"agpl"
]
},
"music": {
"hash": "sha256-h83Xc292/NQPWOTRIbUSgqHUH/Sp4fYJ8GAHSiJWHP0=",
"url": "https://github.com/owncloud/music/releases/download/v2.1.4/music_2.1.4_for_nextcloud.tar.gz",
-10
View File
@@ -219,16 +219,6 @@
"agpl"
]
},
"memories": {
"hash": "sha256-BfxJDCGsiRJrZWkNJSQF3rSFm/G3zzQn7C6DCETSzw4=",
"url": "https://github.com/pulsejet/memories/releases/download/v7.5.2/memories.tar.gz",
"version": "7.5.2",
"description": "# Memories: Photo Management for Nextcloud\n\nMemories is a *batteries-included* photo management solution for Nextcloud with advanced features including:\n\n- **📸 Timeline**: Sort photos and videos by date taken, parsed from Exif data.\n- **⏪ Rewind**: Jump to any time in the past instantly and relive your memories.\n- **🤖 AI Tagging**: Group photos by people and objects, powered by [recognize](https://github.com/nextcloud/recognize) and [facerecognition](https://github.com/matiasdelellis/facerecognition).\n- **🖼️ Albums**: Create albums to group photos and videos together. Then share these albums with others.\n- **🫱🏻‍🫲🏻 External Sharing**: Share photos and videos with people outside of your Nextcloud instance.\n- **📱 Mobile Support**: Work from any device, of any shape and size through the web app.\n- **✏️ Edit Metadata**: Edit dates and other metadata on photos quickly and in bulk.\n- **📦 Archive**: Store photos you don't want to see in your timeline in a separate folder.\n- **📹 Video Transcoding**: Transcode videos and use HLS for maximal performance.\n- **🗺️ Map**: View your photos on a map, tagged with accurate reverse geocoding.\n- **📦 Migration**: Migrate easily from Nextcloud Photos and Google Takeout.\n- **⚡️ Performance**: Do all this very fast.\n\n## 🚀 Installation\n\n1. Install the app from the Nextcloud app store (try a demo [here](https://demo.memories.gallery/apps/memories/)).\n1. Perform the recommended [configuration steps](https://memories.gallery/config/).\n1. Run `php occ memories:index` to generate metadata indices for existing photos.\n1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos.",
"homepage": "https://memories.gallery",
"licenses": [
"agpl"
]
},
"music": {
"hash": "sha256-h83Xc292/NQPWOTRIbUSgqHUH/Sp4fYJ8GAHSiJWHP0=",
"url": "https://github.com/owncloud/music/releases/download/v2.1.4/music_2.1.4_for_nextcloud.tar.gz",
@@ -0,0 +1,32 @@
diff --git a/lib/Settings/SystemConfig.php b/lib/Settings/SystemConfig.php
index 7814f071..bb1309fa 100644
--- a/lib/Settings/SystemConfig.php
+++ b/lib/Settings/SystemConfig.php
@@ -124,6 +125,14 @@ class SystemConfig
*/
public static function get(string $key, mixed $default = null): mixed
{
+ switch ($key) {
+ case "memories.exiftool": return "@exiftool@";
+ case "memories.exiftool_no_local": return false;
+ case "memories.vod.ffmpeg": return "@ffmpeg@";
+ case "memories.vod.ffprobe": return "@ffprobe@";
+ case "memories.vod.path": return "@go-vod@";
+ }
+
if (!\array_key_exists($key, self::DEFAULTS)) {
throw new \InvalidArgumentException("Invalid system config key: {$key}");
}
@@ -154,6 +161,12 @@ public static function get(string $key, mixed $default = null): mixed
*/
public static function set(string $key, mixed $value): void
{
+ // Ignore those paths and always use the nix paths.
+ // We cannot return a proper error message except a 500 here without changing the code to much.
+ if (in_array($key, array("memories.exiftool", "memories.exiftool_no_local", "memories.vod.ffmpeg", "memories.vod.ffprobe", "memories.vod.path"))) {
+ throw new \InvalidArgumentException("Cannot set nix-managed key: {$key}");
+ }
+
// Check if the key is valid
if (!\array_key_exists($key, self::DEFAULTS)) {
throw new \InvalidArgumentException("Invalid system config key: {$key}");
@@ -0,0 +1,91 @@
{
stdenv,
buildGoModule,
exiftool,
fetchurl,
ffmpeg-headless,
fetchFromGitHub,
lib,
replaceVars,
ncVersion,
}:
let
latestVersionForNc = {
"31" = latestVersionForNc."30";
"30" = {
version = "7.5.2";
appHash = "sha256-BfxJDCGsiRJrZWkNJSQF3rSFm/G3zzQn7C6DCETSzw4=";
srcHash = "sha256-imBO/64NW5MiozpufbMRcTI9WCaN8grnHlVo+fsUNlU=";
};
};
currentVersionInfo =
latestVersionForNc.${ncVersion}
or (throw "memories currently does not support nextcloud version ${ncVersion}");
commonMeta = with lib; {
homepage = "https://apps.nextcloud.com/apps/memories";
changelog = "https://github.com/pulsejet/memories/blob/v${currentVersionInfo.version}/CHANGELOG.md";
license = licenses.agpl3Only;
maintainers = with maintainers; [ SuperSandro2000 ];
};
go-vod = buildGoModule rec {
pname = "go-vod";
inherit (currentVersionInfo) version;
src = fetchFromGitHub {
owner = "pulsejet";
repo = "memories";
tag = "v${version}";
hash = currentVersionInfo.srcHash;
};
sourceRoot = "${src.name}/go-vod";
vendorHash = null;
meta = commonMeta // {
description = "Extremely minimal on-demand video transcoding server in go";
mainProgram = "go-vod";
};
};
in
stdenv.mkDerivation rec {
pname = "nextcloud-app-memories";
inherit (currentVersionInfo) version;
src = fetchurl {
url = "https://github.com/pulsejet/memories/releases/download/v${version}/memories.tar.gz";
hash = currentVersionInfo.appHash;
};
patches = [
(replaceVars ./memories-paths.diff {
exiftool = lib.getExe exiftool;
ffmpeg = lib.getExe ffmpeg-headless;
ffprobe = lib.getExe' ffmpeg-headless "ffprobe";
go-vod = lib.getExe go-vod;
})
];
postPatch = ''
rm appinfo/signature.json
rm -rf bin-ext/
substituteInPlace lib/Service/BinExt.php \
--replace-fail "EXIFTOOL_VER = '12.70'" "EXIFTOOL_VER = '${exiftool.version}'"
'';
installPhase = ''
mkdir -p $out
cp -r ./* $out/
'';
meta = commonMeta // {
description = "Fast, modern and advanced photo management suite";
longDescription = ''
All settings related to required packages and installed programs are hardcoded in program code and cannot be changed.
'';
};
}
@@ -23,7 +23,6 @@
, "integration_paperless": "agpl3Plus"
, "mail": "agpl3Plus"
, "maps": "agpl3Plus"
, "memories": "agpl3Plus"
, "music": "agpl3Plus"
, "news": "agpl3Plus"
, "nextpod": "agpl3Only"
@@ -5,10 +5,11 @@ _:
apps = apps.extend (
self: super: {
hmr_enabler = callPackage ./apps/hmr_enabler.nix { };
recognize = callPackage ./apps/recognize.nix { inherit ncVersion; };
memories = callPackage ./apps/memories.nix { inherit ncVersion; };
recognize = callPackage ./apps/recognize.nix { inherit ncVersion; };
}
);
}