nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 replaceVars,
6 fetchDebianPatch,
7 copyDesktopItems,
8 pkg-config,
9 wrapGAppsHook3,
10 unzip,
11 curl,
12 glib,
13 gtk3,
14 libidn2,
15 libssh2,
16 openssl,
17 wxwidgets_3_3,
18 makeDesktopItem,
19}:
20
21let
22 wxwidgets_3_3' = wxwidgets_3_3.overrideAttrs (
23 finalAttrs: previousAttrs: {
24 patches = [
25 ./wxcolorhook.patch
26 ];
27 }
28 );
29in
30stdenv.mkDerivation (finalAttrs: {
31 pname = "freefilesync";
32 version = "14.7";
33
34 src = fetchurl {
35 url = "https://freefilesync.org/download/FreeFileSync_${finalAttrs.version}_Source.zip";
36 # The URL only redirects to the file on the second attempt
37 postFetch = ''
38 rm -f "$out"
39 tryDownload "$url" "$out"
40 '';
41 hash = "sha256-WMSaKA3OA63V6Vis83vXa+y0ZRE0YxgXiB8YAyTSTc8=";
42 };
43
44 sourceRoot = ".";
45
46 patches = [
47 # Disable loading of the missing Animal.dat
48 ./skip-missing-Animal.dat.patch
49 # Fix build with GTK 3
50 (replaceVars ./Makefile.patch {
51 gtk3-dev = lib.getDev gtk3;
52 })
53 # Fix build with vanilla wxWidgets
54 (fetchDebianPatch {
55 pname = "freefilesync";
56 version = "13.7";
57 debianRevision = "1";
58 patch = "Disable_wxWidgets_uncaught_exception_handling.patch";
59 hash = "sha256-Fem7eDDKSqPFU/t12Jco8OmYC8FM9JgB4/QVy/ouvbI=";
60 })
61 ];
62
63 postPatch = ''
64 touch zen/warn_static.h
65 '';
66
67 nativeBuildInputs = [
68 copyDesktopItems
69 pkg-config
70 wrapGAppsHook3
71 unzip
72 ];
73
74 buildInputs = [
75 curl
76 glib
77 gtk3
78 libidn2
79 libssh2
80 openssl
81 wxwidgets_3_3'
82 ];
83
84 env.NIX_CFLAGS_COMPILE = toString [
85 # Undef g_object_ref on GLib 2.56+
86 "-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_54"
87 "-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_54"
88 # Define libssh2 constants
89 "-DMAX_SFTP_READ_SIZE=30000"
90 "-DMAX_SFTP_OUTGOING_SIZE=30000"
91 ];
92
93 buildPhase = ''
94 runHook preBuild
95
96 chmod +w FreeFileSync/Build
97 cd FreeFileSync/Source
98 make -j$NIX_BUILD_CORES
99 cd RealTimeSync
100 make -j$NIX_BUILD_CORES
101 cd ../../..
102
103 runHook postBuild
104 '';
105
106 installPhase = ''
107 runHook preInstall
108
109 mkdir -p $out
110 cp -R FreeFileSync/Build/* $out
111 mv $out/{Bin,bin}
112
113 mkdir -p $out/share/pixmaps
114 unzip -j $out/Resources/Icons.zip '*Sync.png' -d $out/share/pixmaps
115
116 runHook postInstall
117 '';
118
119 desktopItems = [
120 (makeDesktopItem rec {
121 name = "FreeFileSync";
122 desktopName = name;
123 genericName = "Folder Comparison and Synchronization";
124 icon = name;
125 exec = name;
126 categories = [
127 "Utility"
128 "FileTools"
129 ];
130 })
131 (makeDesktopItem rec {
132 name = "RealTimeSync";
133 desktopName = name;
134 genericName = "Automated Synchronization";
135 icon = name;
136 exec = name;
137 categories = [
138 "Utility"
139 "FileTools"
140 ];
141 })
142 ];
143
144 meta = {
145 description = "Open Source File Synchronization & Backup Software";
146 homepage = "https://freefilesync.org";
147 license = [
148 lib.licenses.gpl3Only
149 lib.licenses.openssl
150 lib.licenses.curl
151 lib.licenses.bsd3
152 ];
153 maintainers = with lib.maintainers; [ wegank ];
154 platforms = lib.platforms.linux;
155 };
156})