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" = latestVersionForNc."30";
16 "30" = {
17 version = "7.5.2";
18 appHash = "sha256-BfxJDCGsiRJrZWkNJSQF3rSFm/G3zzQn7C6DCETSzw4=";
19 srcHash = "sha256-imBO/64NW5MiozpufbMRcTI9WCaN8grnHlVo+fsUNlU=";
20 };
21 };
22 currentVersionInfo =
23 latestVersionForNc.${ncVersion}
24 or (throw "memories currently does not support nextcloud version ${ncVersion}");
25
26 commonMeta = with lib; {
27 homepage = "https://apps.nextcloud.com/apps/memories";
28 changelog = "https://github.com/pulsejet/memories/blob/v${currentVersionInfo.version}/CHANGELOG.md";
29 license = licenses.agpl3Only;
30 maintainers = with 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 substituteInPlace lib/Service/BinExt.php \
77 --replace-fail "EXIFTOOL_VER = '12.70'" "EXIFTOOL_VER = '${exiftool.version}'"
78 '';
79
80 installPhase = ''
81 mkdir -p $out
82 cp -r ./* $out/
83 '';
84
85 meta = commonMeta // {
86 description = "Fast, modern and advanced photo management suite";
87 longDescription = ''
88 All settings related to required packages and installed programs are hardcoded in program code and cannot be changed.
89 '';
90 };
91}