QOwnNotes/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.5 KiB
Nix
Raw Normal View History

2023-05-26 08:29:29 +02:00
{ lib
, stdenv
, fetchurl
, 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;
src = builtins.path { path = ./src; name = "qownnotes"; };
2023-05-26 08:29:29 +02:00
nativeBuildInputs = [
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
] ++ 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
] ++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ];
2023-05-26 08:29:29 +02:00
cmakeFlags = [
"-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
# Install shell completion on Linux (with xvfb-run)
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
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
''
# 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
+ lib.optionalString stdenv.hostPlatform.isLinux ''
2023-05-26 08:29:29 +02:00
ln -s $out/bin/${appname} $out/bin/${pname}
''
# Rename application for macOS as lowercase binary
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# 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;
};
}