2023-05-26 08:29:29 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2024-08-06 20:36:08 +02:00
|
|
|
, cmake
|
2023-05-26 08:29:29 +02:00
|
|
|
, qttools
|
|
|
|
, qtbase
|
|
|
|
, qtdeclarative
|
|
|
|
, qtsvg
|
|
|
|
, qtwayland
|
|
|
|
, qtwebsockets
|
|
|
|
, makeWrapper
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, botan2
|
2023-05-28 10:21:32 +02:00
|
|
|
, pkg-config
|
2024-04-12 09:26:16 +02:00
|
|
|
, xvfb-run
|
|
|
|
, installShellFiles
|
2023-05-26 08:29:29 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "qownnotes";
|
|
|
|
appname = "QOwnNotes";
|
2023-12-29 21:46:20 +01:00
|
|
|
# version = builtins.head (builtins.match "#define VERSION \"([0-9.]+)\"" (builtins.readFile ./src/version.h));
|
|
|
|
version = "local-build";
|
2023-05-26 08:29:29 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit pname appname version;
|
|
|
|
|
2024-08-07 19:10:05 +02:00
|
|
|
src = builtins.path { path = ./src; name = "qownnotes"; };
|
2023-05-26 08:29:29 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-08-06 20:36:08 +02:00
|
|
|
cmake
|
2023-05-26 08:29:29 +02:00
|
|
|
qttools
|
|
|
|
wrapQtAppsHook
|
2023-05-28 10:21:32 +02:00
|
|
|
pkg-config
|
2024-04-12 09:26:16 +02:00
|
|
|
installShellFiles
|
2024-12-09 21:04:11 +01:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [ xvfb-run ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper ];
|
2023-05-26 08:29:29 +02:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
qtbase
|
|
|
|
qtdeclarative
|
|
|
|
qtsvg
|
|
|
|
qtwebsockets
|
|
|
|
botan2
|
2024-12-09 21:04:11 +01:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ];
|
2023-05-26 08:29:29 +02:00
|
|
|
|
2024-08-06 20:36:08 +02:00
|
|
|
cmakeFlags = [
|
2024-08-06 21:05:25 +02:00
|
|
|
"-DQON_QT6_BUILD=ON"
|
|
|
|
"-DBUILD_WITH_SYSTEM_BOTAN=ON"
|
2023-05-26 14:44:59 +02:00
|
|
|
];
|
2023-05-26 08:29:29 +02:00
|
|
|
|
2024-12-09 20:39:47 +01:00
|
|
|
# Install shell completion on Linux (with xvfb-run)
|
2024-12-09 21:04:11 +01:00
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-12-09 20:18:45 +01:00
|
|
|
installShellCompletion --cmd ${appname} \
|
|
|
|
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
|
|
|
|
--fish <(xvfb-run $out/bin/${appname} --completion fish)
|
|
|
|
installShellCompletion --cmd ${pname} \
|
|
|
|
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
|
|
|
|
--fish <(xvfb-run $out/bin/${appname} --completion fish)
|
2024-04-12 09:26:16 +02:00
|
|
|
''
|
2024-12-09 20:39:47 +01:00
|
|
|
# Install shell completion on macOS
|
|
|
|
+ lib.optionalString stdenv.isDarwin ''
|
|
|
|
installShellCompletion --cmd ${pname} \
|
|
|
|
--bash <($out/bin/${appname} --completion bash) \
|
|
|
|
--fish <($out/bin/${appname} --completion fish)
|
|
|
|
''
|
2023-05-26 08:29:29 +02:00
|
|
|
# Create a lowercase symlink for Linux
|
2024-12-09 21:04:11 +01:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
2023-05-26 08:29:29 +02:00
|
|
|
ln -s $out/bin/${appname} $out/bin/${pname}
|
|
|
|
''
|
2024-12-13 07:03:09 +01:00
|
|
|
# Rename application for macOS as lowercase binary
|
2024-12-09 21:04:11 +01:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2024-12-09 20:45:31 +01:00
|
|
|
# Prevent "same file" error
|
|
|
|
mv $out/bin/${appname} $out/bin/${pname}.bin
|
|
|
|
mv $out/bin/${pname}.bin $out/bin/${pname}
|
2023-05-26 08:29:29 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-12-14 18:44:26 +01:00
|
|
|
description = "Plain-text file notepad and todo-list manager with Markdown support and Nextcloud/ownCloud integration";
|
2023-05-26 08:29:29 +02:00
|
|
|
homepage = "https://www.qownnotes.org/";
|
|
|
|
changelog = "https://www.qownnotes.org/changelog.html";
|
|
|
|
downloadPage = "https://github.com/pbek/QOwnNotes/releases/tag/v${version}";
|
|
|
|
license = licenses.gpl2Only;
|
|
|
|
maintainers = with maintainers; [ pbek totoroot ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|