nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 buildGoModule,
4 exiftool,
5 fetchurl,
6 ffmpeg-headless,
7 fetchFromGitHub,
8 lib,
9 replaceVars,
10
11 ncVersion,
12}:
13let
14 latestVersionForNc = {
15 "31" = {
16 version = "7.8.2";
17 appHash = "sha256-O59G5kUkYlYxr8p/vEqs3LqLRKJZbeEgDhdY5eHfnZg=";
18 srcHash = "sha256-KyUfrKHnRO3lMin0seSNFRnRRTPo12NbbvbkSpxSMQE=";
19 };
20 "32" = latestVersionForNc."31";
21 };
22 currentVersionInfo =
23 latestVersionForNc.${ncVersion}
24 or (throw "memories currently does not support nextcloud version ${ncVersion}");
25
26 commonMeta = {
27 homepage = "https://apps.nextcloud.com/apps/memories";
28 changelog = "https://github.com/pulsejet/memories/blob/v${currentVersionInfo.version}/CHANGELOG.md";
29 license = lib.licenses.agpl3Only;
30 maintainers = with lib.maintainers; [ SuperSandro2000 ];
31 };
32
33 go-vod = buildGoModule rec {
34 pname = "go-vod";
35 inherit (currentVersionInfo) version;
36
37 src = fetchFromGitHub {
38 owner = "pulsejet";
39 repo = "memories";
40 tag = "v${version}";
41 hash = currentVersionInfo.srcHash;
42 };
43
44 sourceRoot = "${src.name}/go-vod";
45
46 vendorHash = null;
47
48 meta = commonMeta // {
49 description = "Extremely minimal on-demand video transcoding server in go";
50 mainProgram = "go-vod";
51 };
52 };
53in
54stdenv.mkDerivation rec {
55 pname = "nextcloud-app-memories";
56 inherit (currentVersionInfo) version;
57
58 src = fetchurl {
59 url = "https://github.com/pulsejet/memories/releases/download/v${version}/memories.tar.gz";
60 hash = currentVersionInfo.appHash;
61 };
62
63 patches = [
64 (replaceVars ./memories-paths.diff {
65 exiftool = lib.getExe exiftool;
66 ffmpeg = lib.getExe ffmpeg-headless;
67 ffprobe = lib.getExe' ffmpeg-headless "ffprobe";
68 go-vod = lib.getExe go-vod;
69 })
70 ];
71
72 postPatch = ''
73 rm appinfo/signature.json
74 rm -rf bin-ext/
75
76 sed -i 's/EXIFTOOL_VER = .*/EXIFTOOL_VER = @;/' lib/Service/BinExt.php
77 substituteInPlace lib/Service/BinExt.php \
78 --replace-fail "EXIFTOOL_VER = @" "EXIFTOOL_VER = '${exiftool.version}'"
79 '';
80
81 installPhase = ''
82 mkdir -p $out
83 cp -r ./* $out/
84 '';
85
86 meta = commonMeta // {
87 description = "Fast, modern and advanced photo management suite";
88 longDescription = ''
89 All settings related to required packages and installed programs are hardcoded in program code and cannot be changed.
90 '';
91 };
92}