summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--maintainers/maintainer-list.nix5
-rw-r--r--pkgs/applications/misc/megasync/default.nix143
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 150 insertions, 0 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 10d3447af61..266522ab469 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -3278,6 +3278,11 @@
     github = "michelk";
     name = "Michel Kuhlmann";
   };
+  michojel = {
+    email = "mic.liamg@gmail.com";
+    github = "michojel";
+    name = "Michal Minář";
+  };
   mickours = {
     email = "mickours@gmail.com<";
     github = "mickours";
diff --git a/pkgs/applications/misc/megasync/default.nix b/pkgs/applications/misc/megasync/default.nix
new file mode 100644
index 00000000000..a04370f3acd
--- /dev/null
+++ b/pkgs/applications/misc/megasync/default.nix
@@ -0,0 +1,143 @@
+{ lib
+, stdenv
+, autoconf
+, automake
+, bash
+, bashInteractive
+, c-ares
+, cryptopp
+, curl
+, doxygen
+, fetchFromGitHub
+, hicolor-icon-theme
+, libmediainfo
+, libraw
+, libsodium
+, libtool
+, libuv
+, libzen
+, lsb-release
+, makeDesktopItem
+, pkgconfig
+, qt5
+, sqlite
+, swig
+, unzip
+, wget
+, enableFFmpeg   ? true, ffmpeg  ? ffmpeg
+}:
+
+assert enableFFmpeg   -> ffmpeg != null;
+
+stdenv.mkDerivation rec {
+  name = "megasync-${version}";
+  version = "4.1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "meganz";
+    repo = "MEGAsync";
+    rev = "v${version}_Linux";
+    sha256 = "0lc228q3s9xp78dxjn22g6anqlsy1hi7a6yfs4q3l6gyfc3qcxl2";
+    fetchSubmodules = true;
+  };
+
+  desktopItem = makeDesktopItem {
+    name = "megasync";
+    exec = "megasync";
+    icon = "megasync";
+    comment = meta.description;
+    desktopName = "MEGASync";
+    genericName = "File Synchronizer";
+    categories = "Network;FileTransfer;";
+    startupNotify = "false";
+  };
+
+  nativeBuildInputs = [
+    autoconf
+    automake
+    doxygen
+    lsb-release
+    pkgconfig
+    qt5.qmake
+    qt5.qttools
+    swig
+  ];
+  buildInputs = [
+    c-ares
+    cryptopp
+    curl
+    #freeimage    # unreferenced
+    hicolor-icon-theme
+    libmediainfo
+    libraw
+    libsodium
+    libtool
+    libuv
+    libzen
+    qt5.qtbase
+    qt5.qtsvg
+    sqlite
+    unzip
+    wget
+  ] ++ stdenv.lib.optionals enableFFmpeg   [ ffmpeg ];
+
+  patchPhase = ''
+    for file in $(find src/ -type f \( -iname configure -o -iname \*.sh  \) ); do
+      substituteInPlace "$file" \
+        --replace "/bin/bash" "${bashInteractive}/bin/bash"
+    done
+  '';
+
+  preConfigure = ''
+    cd src/MEGASync/mega
+    ./autogen.sh
+  '';
+
+  configureScript = "./configure";
+
+  configureFlags = [
+          "--disable-examples"
+          "--disable-java"
+          "--disable-php"
+          "--enable-chat"
+          "--with-cares"
+          "--with-cryptopp"
+          "--with-curl"
+          "--without-freeimage"  # unreferenced even when found
+          "--without-readline"
+          "--without-termcap"
+          "--with-sodium"
+          "--with-sqlite"
+          "--with-zlib"
+    ] ++ stdenv.lib.optionals enableFFmpeg ["--with-ffmpeg"];
+
+  # TODO: unless overriden, qmake is called instead ??
+  configurePhase = ''
+    runHook preConfigure
+    ./configure ${toString configureFlags}
+    runHook postConfigure
+  '';
+
+  postConfigure = "cd ../..";
+
+  preBuild = ''
+    qmake CONFIG+="release" MEGA.pro
+    lrelease MEGASync/MEGASync.pro
+  '';
+
+  # TODO: install bindings
+  installPhase = ''
+    mkdir -p $out/share/icons
+    install -Dm 755 MEGASync/megasync $out/bin/megasync
+    cp -r ${desktopItem}/share/applications $out/share
+    cp MEGASync/gui/images/uptodate.svg $out/share/icons/megasync.svg
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Easy automated syncing between your computers and your MEGA Cloud Drive";
+    homepage    = https://mega.nz/;
+    license     = licenses.free;
+    platforms   = [ "i686-linux" "x86_64-linux" ];
+    maintainers = [ maintainers.michojel ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 2090543ba94..9ec6334a5a5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1695,6 +1695,8 @@ in
 
   massren = callPackage ../tools/misc/massren { };
 
+  megasync = callPackage ../applications/misc/megasync { };
+
   meritous = callPackage ../games/meritous { };
 
   opendune = callPackage ../games/opendune { };