lol
1{ lib
2, stdenv
3, autoconf
4, automake
5, c-ares
6, cryptopp
7, curl
8, doxygen
9, fetchFromGitHub
10#, ffmpeg
11, libmediainfo
12, libraw
13, libsodium
14, libtool
15, libuv
16, libzen
17, lsb-release
18, mkDerivation
19, pkg-config
20, qtbase
21, qttools
22, qtx11extras
23, sqlite
24, swig
25, unzip
26, wget
27}:
28mkDerivation rec {
29 pname = "megasync";
30 version = "4.5.3.0";
31
32 src = fetchFromGitHub {
33 owner = "meganz";
34 repo = "MEGAsync";
35 rev = "v${version}_Linux";
36 sha256 = "1lwjmdbqyxx5wd8nx4mc830fna37jad4h93viwfh5x7sxn104js7";
37 fetchSubmodules = true;
38 };
39
40 nativeBuildInputs = [
41 autoconf
42 automake
43 doxygen
44 libtool
45 lsb-release
46 pkg-config
47 qttools
48 swig
49 unzip
50 ];
51 buildInputs = [
52 c-ares
53 cryptopp
54 curl
55 # temporarily disable until patched for ffmpeg 4.4
56 #ffmpeg
57 libmediainfo
58 libraw
59 libsodium
60 libuv
61 libzen
62 qtbase
63 qtx11extras
64 sqlite
65 wget
66 ];
67
68 patches = [
69 # Distro and version targets attempt to use lsb_release which is broken
70 # (see issue: https://github.com/NixOS/nixpkgs/issues/22729)
71 ./noinstall-distro-version.patch
72 # megasync target is not part of the install rule thanks to a commented block
73 ./install-megasync.patch
74 ];
75
76 postPatch = ''
77 for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do
78 substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}"
79 done
80 '';
81
82 dontUseQmakeConfigure = true;
83 enableParallelBuilding = true;
84
85 preConfigure = ''
86 cd src/MEGASync/mega
87 ./autogen.sh
88 '';
89
90 configureFlags = [
91 "--disable-examples"
92 "--disable-java"
93 "--disable-php"
94 "--enable-chat"
95 "--with-cares"
96 "--with-cryptopp"
97 "--with-curl"
98 # temporarily disable until patched for ffmpeg 4.4
99 #"--with-ffmpeg"
100 "--without-freeimage" # unreferenced even when found
101 "--without-readline"
102 "--without-termcap"
103 "--with-sodium"
104 "--with-sqlite"
105 "--with-zlib"
106 ];
107
108 postConfigure = ''
109 cd ../..
110 '';
111
112 preBuild = ''
113 qmake CONFIG+="release" MEGA.pro
114 pushd MEGASync
115 lrelease MEGASync.pro
116 DESKTOP_DESTDIR="$out" qmake PREFIX="$out" -o Makefile MEGASync.pro CONFIG+=release
117 popd
118 '';
119
120 meta = with lib; {
121 description =
122 "Easy automated syncing between your computers and your MEGA Cloud Drive";
123 homepage = "https://mega.nz/";
124 license = licenses.unfree;
125 platforms = [ "i686-linux" "x86_64-linux" ];
126 maintainers = [ maintainers.michojel ];
127 };
128}