22 withFreeImage ? false, # default to false because freeimage is insecure
29 if stdenv.isLinux then
31 tag = "${version}_Linux";
32 hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM=";
36 tag = "${version}_macOS";
37 hash = "sha256-UlSqwM8GQKeG8/K0t5DbM034NQOeBg+ujNi/MMsVCuM=";
41 inherit pname version;
43 src = fetchFromGitHub (
48 fetchSubmodules = true;
52 enableParallelBuilding = true;
59 lib.optionals stdenv.isLinux [ gcc-unwrapped ] # fix: ld: cannot find lib64/libstdc++fs.a
75 ++ lib.optionals withFreeImage [ freeimage ];
91 ] ++ (if withFreeImage then [ "--with-freeimage" ] else [ "--without-freeimage" ]);
93 # On darwin, some macros defined in AssertMacros.h (from apple-sdk) are conflicting.
95 echo '#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0' >> sdk/include/mega/config.h
99 ./fix-ffmpeg.patch # https://github.com/meganz/sdk/issues/2635#issuecomment-1495405085
100 ./fix-darwin.patch # fix: libtool tag not found; MacFileSystemAccess not declared; server cannot init
104 description = "MEGA Command Line Interactive and Scriptable Application";
105 homepage = "https://mega.io/cmd";
106 license = with lib.licenses; [
110 platforms = lib.platforms.linux ++ lib.platforms.darwin;
111 maintainers = with lib.maintainers; [