2024-02-29 20:09:43 +00:00
|
|
|
{ lib
|
2023-04-29 16:46:19 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, qtbase
|
2024-02-29 20:09:43 +00:00
|
|
|
, qtsvg
|
2024-04-21 15:54:59 +00:00
|
|
|
, qtwayland
|
2020-04-24 23:36:52 +00:00
|
|
|
, qtwebengine
|
|
|
|
, qtdeclarative
|
|
|
|
, extra-cmake-modules
|
|
|
|
, cpp-utilities
|
|
|
|
, qtutilities
|
2022-06-16 17:23:12 +00:00
|
|
|
, qtforkawesome
|
|
|
|
, boost
|
2023-10-09 19:29:22 +00:00
|
|
|
, wrapQtAppsHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
|
|
|
, kio
|
|
|
|
, plasma-framework
|
|
|
|
, qttools
|
2023-04-29 16:46:19 +00:00
|
|
|
, iconv
|
2023-10-09 19:29:22 +00:00
|
|
|
, cppunit
|
|
|
|
, syncthing
|
2024-01-02 11:29:13 +00:00
|
|
|
, xdg-utils
|
2020-04-24 23:36:52 +00:00
|
|
|
, webviewSupport ? true
|
|
|
|
, jsSupport ? true
|
2023-04-29 16:46:19 +00:00
|
|
|
, kioPluginSupport ? stdenv.isLinux
|
|
|
|
, plasmoidSupport ? stdenv.isLinux
|
|
|
|
, systemdSupport ? stdenv.isLinux
|
2023-03-04 12:14:45 +00:00
|
|
|
/* It is possible to set via this option an absolute exec path that will be
|
|
|
|
written to the `~/.config/autostart/syncthingtray.desktop` file generated
|
|
|
|
during runtime. Alternatively, one can edit the desktop file themselves after
|
|
|
|
it is generated See:
|
|
|
|
https://github.com/NixOS/nixpkgs/issues/199596#issuecomment-1310136382 */
|
|
|
|
, autostartExecPath ? "syncthingtray"
|
2024-07-27 06:49:29 +00:00
|
|
|
, versionCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.6.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "syncthingtray";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Martchus";
|
|
|
|
repo = "syncthingtray";
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-L56aX5UFFodSR2YHWt6Y+s83q3YoAuYvyqXP/XVMp20=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildInputs = [
|
|
|
|
qtbase
|
2024-02-29 20:09:43 +00:00
|
|
|
qtsvg
|
2022-06-16 17:23:12 +00:00
|
|
|
cpp-utilities
|
|
|
|
qtutilities
|
|
|
|
boost
|
|
|
|
qtforkawesome
|
2023-04-29 16:46:19 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [ iconv ]
|
2024-04-21 15:54:59 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ qtwayland ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optionals webviewSupport [ qtwebengine ]
|
|
|
|
++ lib.optionals jsSupport [ qtdeclarative ]
|
|
|
|
++ lib.optionals kioPluginSupport [ kio ]
|
2021-03-15 08:37:03 +00:00
|
|
|
++ lib.optionals plasmoidSupport [ plasma-framework ]
|
2020-04-24 23:36:52 +00:00
|
|
|
;
|
|
|
|
|
2021-03-15 08:37:03 +00:00
|
|
|
nativeBuildInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
wrapQtAppsHook
|
2021-03-15 08:37:03 +00:00
|
|
|
cmake
|
|
|
|
qttools
|
2023-10-09 19:29:22 +00:00
|
|
|
# Although these are test dependencies, we add them anyway so that we test
|
|
|
|
# whether the test units compile. On Darwin we don't run the tests but we
|
|
|
|
# still build them.
|
|
|
|
cppunit
|
|
|
|
syncthing
|
2021-03-15 08:37:03 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals plasmoidSupport [ extra-cmake-modules ]
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# syncthing server seems to hang on darwin, causing tests to fail.
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
preCheck = ''
|
|
|
|
export QT_QPA_PLATFORM=offscreen
|
2024-02-29 20:09:43 +00:00
|
|
|
export QT_PLUGIN_PATH="${lib.getBin qtbase}/${qtbase.qtPluginPrefix}"
|
2023-10-09 19:29:22 +00:00
|
|
|
'';
|
2024-04-21 15:54:59 +00:00
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
|
|
|
# put the app bundle into the proper place /Applications instead of /bin
|
|
|
|
mkdir -p $out/Applications
|
|
|
|
mv $out/bin/syncthingtray.app $out/Applications
|
|
|
|
# Make binary available in PATH like on other platforms
|
|
|
|
ln -s $out/Applications/syncthingtray.app/Contents/MacOS/syncthingtray $out/bin/syncthingtray
|
|
|
|
'';
|
2024-07-27 06:49:29 +00:00
|
|
|
nativeInstallCheckInputs = [
|
|
|
|
versionCheckHook
|
|
|
|
];
|
|
|
|
doInstallCheck = true;
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
2024-02-29 20:09:43 +00:00
|
|
|
"-DQT_PACKAGE_PREFIX=Qt${lib.versions.major qtbase.version}"
|
|
|
|
"-DKF_PACKAGE_PREFIX=KF${lib.versions.major qtbase.version}"
|
2023-10-09 19:29:22 +00:00
|
|
|
"-DBUILD_TESTING=ON"
|
|
|
|
# See https://github.com/Martchus/syncthingtray/issues/208
|
|
|
|
"-DEXCLUDE_TESTS_FROM_ALL=OFF"
|
2023-03-04 12:14:45 +00:00
|
|
|
"-DAUTOSTART_EXEC_PATH=${autostartExecPath}"
|
2020-04-24 23:36:52 +00:00
|
|
|
# See https://github.com/Martchus/syncthingtray/issues/42
|
2023-08-04 22:07:22 +00:00
|
|
|
"-DQT_PLUGIN_DIR:STRING=${placeholder "out"}/${qtbase.qtPluginPrefix}"
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ lib.optionals (!plasmoidSupport) ["-DNO_PLASMOID=ON"]
|
|
|
|
++ lib.optionals (!kioPluginSupport) ["-DNO_FILE_ITEM_ACTION_PLUGIN=ON"]
|
|
|
|
++ lib.optionals systemdSupport ["-DSYSTEMD_SUPPORT=ON"]
|
|
|
|
++ lib.optionals (!webviewSupport) ["-DWEBVIEW_PROVIDER:STRING=none"]
|
|
|
|
;
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
qtWrapperArgs = [
|
|
|
|
"--prefix PATH : ${lib.makeBinPath [ xdg-utils ]}"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/Martchus/syncthingtray";
|
|
|
|
description = "Tray application and Dolphin/Plasma integration for Syncthing";
|
2021-03-15 08:37:03 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ doronbehar ];
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|