38 stdenv.mkDerivation rec {
40 version = "1.14.6.19-stable";
42 src = fetchFromGitHub {
44 repo = "synergy-core";
46 sha256 = "sha256-0QqklfSsvcXh7I2jaHk82k0nY8gQOj9haA4WOjGqBqY=";
47 fetchSubmodules = true;
51 # Without this OpenSSL from nixpkgs is not detected
52 ./darwin-non-static-openssl.patch
53 ] ++ lib.optionals (stdenv.isDarwin && !(darwin.apple_sdk.frameworks ? UserNotifications)) [
54 # We cannot include UserNotifications because of a build failure in the Apple SDK.
55 # The functions used from it are already implicitly included anyways.
56 ./darwin-no-UserNotifications-includes.patch
60 substituteInPlace src/gui/src/SslCertificate.cpp \
61 --replace 'kUnixOpenSslCommand[] = "openssl";' 'kUnixOpenSslCommand[] = "${openssl}/bin/openssl";'
62 '' + lib.optionalString stdenv.isLinux ''
63 substituteInPlace src/lib/synergy/unix/AppUtilUnix.cpp \
64 --replace "/usr/share/X11/xkb/rules/evdev.xml" "${xkeyboardconfig}/share/X11/xkb/rules/evdev.xml"
70 ] ++ lib.optional withGUI wrapQtAppsHook;
73 qttools # Used for translations even when not building the GUI
76 ] ++ lib.optionals stdenv.isDarwin [
82 ] ++ lib.optionals (stdenv.isDarwin && darwin.apple_sdk.frameworks ? UserNotifications) [
83 darwin.apple_sdk.frameworks.UserNotifications
84 ] ++ lib.optionals stdenv.isLinux [
102 # Silences many warnings
103 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-Wno-inconsistent-missing-override";
105 cmakeFlags = lib.optional (!withGUI) "-DSYNERGY_BUILD_LEGACY_GUI=OFF"
106 # NSFilenamesPboardType is deprecated in 10.14+
107 ++ lib.optional stdenv.isDarwin "-DCMAKE_OSX_DEPLOYMENT_TARGET=${if stdenv.isAarch64 then "10.13" else stdenv.hostPlatform.darwinSdkVersion}";
121 cp bin/{synergyc,synergys,synergyd,syntool} $out/bin/
122 '' + lib.optionalString withGUI ''
123 cp bin/synergy $out/bin/
124 '' + lib.optionalString stdenv.isLinux ''
125 mkdir -p $out/share/{applications,icons/hicolor/scalable/apps}
126 cp ../res/synergy.svg $out/share/icons/hicolor/scalable/apps/
127 substitute ../res/synergy.desktop $out/share/applications/synergy.desktop \
128 --replace "/usr/bin" "$out/bin"
129 '' + lib.optionalString stdenv.isDarwin ''
130 mkdir -p $out/Applications
131 cp -r bundle/Synergy.app $out/Applications
132 ln -s $out/bin $out/Applications/Synergy.app/Contents/MacOS
137 dontWrapQtApps = lib.optional (!withGUI) true;
140 description = "Share one mouse and keyboard between multiple computers";
141 homepage = "https://symless.com/synergy";
142 changelog = "https://github.com/symless/synergy-core/blob/${version}/ChangeLog";
143 mainProgram = lib.optionalString (!withGUI) "synergyc";
144 license = licenses.gpl2Only;
145 maintainers = with maintainers; [ talyz ivar ];
146 platforms = platforms.unix;