Unverified Commit e1bb5891 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

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

nextcloud31Packages.apps.memories: package by hand to remove pre-compiled binaries; nextcloud31Packages.apps.recognize: more cleanup (#388067)
parents 2dcc4b15 2bd9e401
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -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 −10
Original line number Diff line number Diff line
@@ -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",
+32 −0
Original line number Diff line number Diff line
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}");
+91 −0
Original line number Diff line number Diff line
{
  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.
    '';
  };
}
+5 −10
Original line number Diff line number Diff line
@@ -38,22 +38,19 @@ stdenv.mkDerivation rec {
  srcs =
    [
      (fetchurl {
        inherit version;
        url = "https://github.com/nextcloud/recognize/releases/download/v${version}/recognize-${version}.tar.gz";
        hash = currentVersionInfo.appHash;
      })

      (fetchurl {
        inherit version;
        url = "https://github.com/nextcloud/recognize/archive/refs/tags/v${version}.tar.gz";
        hash = currentVersionInfo.modelHash;
      })
    ]
    ++ lib.optionals useLibTensorflow [
      (fetchurl rec {
      (fetchurl {
        # For version see LIBTENSORFLOW_VERSION in https://github.com/tensorflow/tfjs/blob/master/tfjs-node/scripts/deps-constants.js
        version = "2.9.1";
        url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-${version}.tar.gz";
        url = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.9.1.tar.gz";
        hash = "sha256-f1ENJUbj214QsdEZRjaJAD1YeEKJKtPJW8pRz4KCAXM=";
      })
    ];
@@ -61,7 +58,7 @@ stdenv.mkDerivation rec {
  unpackPhase =
    ''
      # Merge the app and the models from github
      tar -xzpf "${builtins.elemAt srcs 0}" recognize;
      tar -xzpf "${builtins.elemAt srcs 0}" recognize
      tar -xzpf "${builtins.elemAt srcs 1}" -C recognize --strip-components=1 recognize-${version}/models
    ''
    + lib.optionalString useLibTensorflow ''
@@ -81,8 +78,6 @@ stdenv.mkDerivation rec {
      --replace-quiet "\$this->config->getAppValueString('node_binary')" "'${lib.getExe nodejs}'"
    test "$(grep "get[a-zA-Z]*('node_binary'" recognize/lib/**/*.php | wc -l)" -eq 0



    # Skip trying to install it... (less warnings in the log)
    sed  -i '/public function run/areturn ; //skip' recognize/lib/Migration/InstallDeps.php

@@ -110,10 +105,10 @@ stdenv.mkDerivation rec {
    node src/test_libtensorflow.js
    cd ..
  '';

  installPhase = ''
    approot="$(dirname $(dirname $(find -path '*/appinfo/info.xml' | head -n 1)))"
    if [ -d "$approot" ];
    then
    if [ -d "$approot" ]; then
      mv "$approot/" $out
      chmod -R a-w $out
    fi
Loading