From e6b5a9e6447cdcc7e92485e9661b0e7d58b6ee89 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 14 Mar 2025 10:14:13 +0100 Subject: [PATCH] megasync: cleanup --- pkgs/by-name/me/megasync/package.nix | 121 ++++++++++++++++----------- 1 file changed, 70 insertions(+), 51 deletions(-) diff --git a/pkgs/by-name/me/megasync/package.nix b/pkgs/by-name/me/megasync/package.nix index c64924058aaf..210ca2db67c9 100644 --- a/pkgs/by-name/me/megasync/package.nix +++ b/pkgs/by-name/me/megasync/package.nix @@ -1,40 +1,45 @@ { lib, stdenv, - c-ares, - cmake, - cryptopp, - curl, fetchFromGitHub, fetchpatch, + + # nativeBuildInputs + cmake, + libsForQt5, + libtool, + pkg-config, + unzip, + + # buildInputs + c-ares, + cryptopp, + curl, ffmpeg, hicolor-icon-theme, icu, libmediainfo, libsodium, - libtool, libuv, libxcb, libzen, openssl, - pkg-config, - libsForQt5, readline, sqlite, - unzip, wget, xorg, zlib, - qt5, + + nix-update-script, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "megasync"; version = "5.8.0.2"; src = fetchFromGitHub rec { owner = "meganz"; repo = "MEGAsync"; - rev = "v${version}_Linux"; + tag = "v${finalAttrs.version}_Linux"; hash = "sha256-/q7LD1/06+0MepDz3fVrlvGKh+rvNk6d1hm7Ng54Nmk="; fetchSubmodules = false; # DesignTokensImporter cannot be fetched, see #1010 in github:meganz/megasync leaveDotGit = true; @@ -44,47 +49,13 @@ stdenv.mkDerivation rec { git remote add origin $url git fetch origin git clean -fdx - git checkout ${rev} + git checkout ${tag} git submodule update --init src/MEGASync/mega rm -rf .git ''; # Why so complicated, I just want a single submodule }; - nativeBuildInputs = [ - cmake - libtool - pkg-config - libsForQt5.qttools - unzip - libsForQt5.wrapQtAppsHook - ]; - buildInputs = [ - c-ares - cryptopp - curl - ffmpeg - hicolor-icon-theme - icu - libmediainfo - libsodium - libuv - libxcb - libzen - openssl - libsForQt5.qtbase - libsForQt5.qtdeclarative - libsForQt5.qtgraphicaleffects - libsForQt5.qtquickcontrols - libsForQt5.qtquickcontrols2 - libsForQt5.qtsvg - libsForQt5.qtx11extras - readline - sqlite - wget - zlib - ]; - patches = [ (fetchpatch { url = "https://aur.archlinux.org/cgit/aur.git/plain/020-megasync-sdk-fix-cmake-dependencies-detection.patch?h=megasync&id=ff59780039697591e7e3a966db058b23bee0451c"; @@ -101,12 +72,49 @@ stdenv.mkDerivation rec { ]; postPatch = '' - substituteInPlace cmake/modules/desktopapp_options.cmake --replace-fail "ENABLE_ISOLATED_GFX ON" "ENABLE_ISOLATED_GFX OFF" + substituteInPlace cmake/modules/desktopapp_options.cmake \ + --replace-fail "ENABLE_ISOLATED_GFX ON" "ENABLE_ISOLATED_GFX OFF" + for file in $(find src/ -type f \( -iname configure -o -iname \*.sh \) ); do - substituteInPlace "$file" --replace "/bin/bash" "${stdenv.shell}" + substituteInPlace "$file" --replace-warn "/bin/bash" "${stdenv.shell}" done ''; + nativeBuildInputs = [ + cmake + libsForQt5.qttools + libsForQt5.wrapQtAppsHook + libtool + pkg-config + unzip + ]; + + buildInputs = [ + c-ares + cryptopp + curl + ffmpeg + hicolor-icon-theme + icu + libmediainfo + libsForQt5.qtbase + libsForQt5.qtdeclarative + libsForQt5.qtgraphicaleffects + libsForQt5.qtquickcontrols + libsForQt5.qtquickcontrols2 + libsForQt5.qtsvg + libsForQt5.qtx11extras + libsodium + libuv + libxcb + libzen + openssl + readline + sqlite + wget + zlib + ]; + dontUseQmakeConfigure = true; enableParallelBuilding = true; @@ -120,14 +128,25 @@ stdenv.mkDerivation rec { qtWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ xorg.xrdb ]}) ''; - meta = with lib; { + passthru = { + updateScript = nix-update-script { + extraArgs = [ + "--version-regex=^v(.*)_Linux$" + ]; + }; + }; + + meta = { description = "Easy automated syncing between your computers and your MEGA Cloud Drive"; homepage = "https://mega.nz/"; - license = licenses.unfree; + downloadPage = "https://github.com/meganz/MEGAsync"; + changelog = "https://github.com/meganz/MEGAsync/releases/tag/v${finalAttrs.version}_Linux"; + license = lib.licenses.unfree; platforms = [ "i686-linux" "x86_64-linux" ]; maintainers = [ ]; + mainProgram = "megasync"; }; -} +})