Skip to content

Commit e6b5a9e

Browse files
committed
megasync: cleanup
1 parent 4072944 commit e6b5a9e

File tree

1 file changed

+62
-43
lines changed

1 file changed

+62
-43
lines changed
Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
{
22
lib,
33
stdenv,
4-
c-ares,
4+
fetchFromGitHub,
5+
fetchpatch,
6+
7+
# nativeBuildInputs
58
cmake,
9+
libsForQt5,
10+
libtool,
11+
pkg-config,
12+
unzip,
13+
14+
# buildInputs
15+
c-ares,
616
cryptopp,
717
curl,
8-
fetchFromGitHub,
9-
fetchpatch,
1018
ffmpeg,
1119
hicolor-icon-theme,
1220
icu,
1321
libmediainfo,
1422
libsodium,
15-
libtool,
1623
libuv,
1724
libxcb,
1825
libzen,
1926
openssl,
20-
pkg-config,
21-
libsForQt5,
2227
readline,
2328
sqlite,
24-
unzip,
2529
wget,
2630
xorg,
2731
zlib,
28-
qt5,
32+
33+
nix-update-script,
2934
}:
30-
stdenv.mkDerivation rec {
35+
stdenv.mkDerivation (finalAttrs: {
3136
pname = "megasync";
3237
version = "5.8.0.2";
3338

3439
src = fetchFromGitHub rec {
3540
owner = "meganz";
3641
repo = "MEGAsync";
37-
rev = "v${version}_Linux";
42+
tag = "v${finalAttrs.version}_Linux";
3843
hash = "sha256-/q7LD1/06+0MepDz3fVrlvGKh+rvNk6d1hm7Ng54Nmk=";
3944
fetchSubmodules = false; # DesignTokensImporter cannot be fetched, see #1010 in github:meganz/megasync
4045
leaveDotGit = true;
@@ -44,21 +49,46 @@ stdenv.mkDerivation rec {
4449
git remote add origin $url
4550
git fetch origin
4651
git clean -fdx
47-
git checkout ${rev}
52+
git checkout ${tag}
4853
git submodule update --init src/MEGASync/mega
4954
5055
rm -rf .git
5156
''; # Why so complicated, I just want a single submodule
5257
};
5358

59+
patches = [
60+
(fetchpatch {
61+
url = "https://aur.archlinux.org/cgit/aur.git/plain/020-megasync-sdk-fix-cmake-dependencies-detection.patch?h=megasync&id=ff59780039697591e7e3a966db058b23bee0451c";
62+
hash = "sha256-hQY6tMwiV3B6M6WiFdOESdhahAtuWjdoj2eI2mst/K8=";
63+
extraPrefix = "src/MEGASync/mega/";
64+
stripLen = true;
65+
})
66+
(fetchpatch {
67+
url = "https://aur.archlinux.org/cgit/aur.git/plain/030-megasync-app-fix-cmake-dependencies-detection.patch?h=megasync&id=ff59780039697591e7e3a966db058b23bee0451c";
68+
hash = "sha256-11XWctv1veUEguc9Xvz2hMYw26CaCwu6M4hyA+5r81U=";
69+
})
70+
./megasync-fix-cmake-install-bindir.patch
71+
./dont-fetch-clang-format.patch
72+
];
73+
74+
postPatch = ''
75+
substituteInPlace cmake/modules/desktopapp_options.cmake \
76+
--replace-fail "ENABLE_ISOLATED_GFX ON" "ENABLE_ISOLATED_GFX OFF"
77+
78+
for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do
79+
substituteInPlace "$file" --replace-warn "/bin/bash" "${stdenv.shell}"
80+
done
81+
'';
82+
5483
nativeBuildInputs = [
5584
cmake
85+
libsForQt5.qttools
86+
libsForQt5.wrapQtAppsHook
5687
libtool
5788
pkg-config
58-
libsForQt5.qttools
5989
unzip
60-
libsForQt5.wrapQtAppsHook
6190
];
91+
6292
buildInputs = [
6393
c-ares
6494
cryptopp
@@ -67,46 +97,24 @@ stdenv.mkDerivation rec {
6797
hicolor-icon-theme
6898
icu
6999
libmediainfo
70-
libsodium
71-
libuv
72-
libxcb
73-
libzen
74-
openssl
75100
libsForQt5.qtbase
76101
libsForQt5.qtdeclarative
77102
libsForQt5.qtgraphicaleffects
78103
libsForQt5.qtquickcontrols
79104
libsForQt5.qtquickcontrols2
80105
libsForQt5.qtsvg
81106
libsForQt5.qtx11extras
107+
libsodium
108+
libuv
109+
libxcb
110+
libzen
111+
openssl
82112
readline
83113
sqlite
84114
wget
85115
zlib
86116
];
87117

88-
patches = [
89-
(fetchpatch {
90-
url = "https://aur.archlinux.org/cgit/aur.git/plain/020-megasync-sdk-fix-cmake-dependencies-detection.patch?h=megasync&id=ff59780039697591e7e3a966db058b23bee0451c";
91-
hash = "sha256-hQY6tMwiV3B6M6WiFdOESdhahAtuWjdoj2eI2mst/K8=";
92-
extraPrefix = "src/MEGASync/mega/";
93-
stripLen = true;
94-
})
95-
(fetchpatch {
96-
url = "https://aur.archlinux.org/cgit/aur.git/plain/030-megasync-app-fix-cmake-dependencies-detection.patch?h=megasync&id=ff59780039697591e7e3a966db058b23bee0451c";
97-
hash = "sha256-11XWctv1veUEguc9Xvz2hMYw26CaCwu6M4hyA+5r81U=";
98-
})
99-
./megasync-fix-cmake-install-bindir.patch
100-
./dont-fetch-clang-format.patch
101-
];
102-
103-
postPatch = ''
104-
substituteInPlace cmake/modules/desktopapp_options.cmake --replace-fail "ENABLE_ISOLATED_GFX ON" "ENABLE_ISOLATED_GFX OFF"
105-
for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do
106-
substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}"
107-
done
108-
'';
109-
110118
dontUseQmakeConfigure = true;
111119
enableParallelBuilding = true;
112120

@@ -120,14 +128,25 @@ stdenv.mkDerivation rec {
120128
qtWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ xorg.xrdb ]})
121129
'';
122130

123-
meta = with lib; {
131+
passthru = {
132+
updateScript = nix-update-script {
133+
extraArgs = [
134+
"--version-regex=^v(.*)_Linux$"
135+
];
136+
};
137+
};
138+
139+
meta = {
124140
description = "Easy automated syncing between your computers and your MEGA Cloud Drive";
125141
homepage = "https://mega.nz/";
126-
license = licenses.unfree;
142+
downloadPage = "https://github.com/meganz/MEGAsync";
143+
changelog = "https://github.com/meganz/MEGAsync/releases/tag/v${finalAttrs.version}_Linux";
144+
license = lib.licenses.unfree;
127145
platforms = [
128146
"i686-linux"
129147
"x86_64-linux"
130148
];
131149
maintainers = [ ];
150+
mainProgram = "megasync";
132151
};
133-
}
152+
})

0 commit comments

Comments
 (0)