about summary refs log tree commit diff
path: root/pkgs/applications/networking/freefilesync
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2022-10-07 13:04:55 +0200
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2022-10-07 13:04:55 +0200
commit60d578bfe72f6ed016558357aaa84354db61c0fe (patch)
tree9d5464ad160f51cd3ab7f51f07905ffd10a503ff /pkgs/applications/networking/freefilesync
parenta989aa4619162ff37bcbb8c2fb1e502658647fb2 (diff)
freefilesync: init at 11.25
Diffstat (limited to 'pkgs/applications/networking/freefilesync')
-rw-r--r--pkgs/applications/networking/freefilesync/default.nix103
1 files changed, 103 insertions, 0 deletions
diff --git a/pkgs/applications/networking/freefilesync/default.nix b/pkgs/applications/networking/freefilesync/default.nix
new file mode 100644
index 0000000000000..aa5b0fcc4b063
--- /dev/null
+++ b/pkgs/applications/networking/freefilesync/default.nix
@@ -0,0 +1,103 @@
+{ lib
+, gcc12Stdenv
+, fetchFromGitHub
+, fetchpatch
+, pkg-config
+, curl
+, glib
+, gtk3
+, libssh2
+, openssl
+, wxGTK32
+}:
+
+gcc12Stdenv.mkDerivation rec {
+  pname = "freefilesync";
+  version = "11.25";
+
+  src = fetchFromGitHub {
+    owner = "hkneptune";
+    repo = "FreeFileSync";
+    rev = "v${version}";
+    sha256 = "sha256-JV9qwBiF9kl+wc9+7lUufQVu6uiMQ6vojntxduNJ8MI=";
+  };
+
+  # Patches from ROSA Linux
+  patches = [
+    # Disable loading of the missing Animal.dat
+    (fetchpatch {
+      url = "https://abf.io/import/freefilesync/raw/rosa2021.1-11.25-1/ffs_devuan.patch";
+      sha256 = "sha256-o8T/tBinlhM1I82yXxm0ogZcZf+uri95vTJrca5mcqs=";
+      excludes = [ "FreeFileSync/Source/ffs_paths.cpp" ];
+      postFetch = ''
+        substituteInPlace $out --replace " for Rosa" ""
+      '';
+    })
+    # Fix build with GTK 3
+    (fetchpatch {
+      url = "https://abf.io/import/freefilesync/raw/rosa2021.1-11.25-1/ffs_devuan_gtk3.patch";
+      sha256 = "sha256-NXt/+BRTcMk8bnjR9Hipv1NzV9YqRJqy0e3RMInoWsA=";
+      postFetch = ''
+        substituteInPlace $out --replace "-isystem/usr/include/gtk-3.0" ""
+      '';
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace FreeFileSync/Source/ui/version_check.cpp \
+      --replace "openBrowserForDownload();" "openBrowserForDownload(parent);"
+  '';
+
+  nativeBuildInputs = [
+    pkg-config
+  ];
+
+  buildInputs = [
+    curl
+    glib
+    gtk3
+    libssh2
+    openssl
+    wxGTK32
+  ];
+
+  NIX_CFLAGS_COMPILE = [
+    # Undef g_object_ref on GLib 2.56+
+    "-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_54"
+    "-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_54"
+    # Define libssh2 constants
+    "-DMAX_SFTP_READ_SIZE=30000"
+    "-DMAX_SFTP_OUTGOING_SIZE=30000"
+  ];
+
+  buildPhase = ''
+    runHook preBuild
+
+    chmod +w FreeFileSync/Build
+    cd FreeFileSync/Source
+    make -j$NIX_BUILD_CORES
+    cd RealTimeSync
+    make -j$NIX_BUILD_CORES
+    cd ../../..
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out
+    cp -R FreeFileSync/Build/* $out
+    mv $out/{Bin,bin}
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Open Source File Synchronization & Backup Software";
+    homepage = "https://freefilesync.org";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ wegank ];
+    platforms = platforms.linux;
+  };
+}