QOwnNotes/default.nix

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

101 lines
2.6 KiB
Nix
Raw Permalink Normal View History

{
lib,
stdenv,
fetchurl,
cmake,
qttools,
qtbase,
qtdeclarative,
qtsvg,
qtwayland,
qtwebsockets,
makeWrapper,
wrapQtAppsHook,
botan3,
libgit2,
pkg-config,
xvfb-run,
installShellFiles,
}:
2023-05-26 08:29:29 +02:00
let
pname = "qownnotes";
appname = "QOwnNotes";
# version = builtins.head (builtins.match "#define VERSION \"([0-9.]+)\"" (builtins.readFile ./src/version.h));
2023-12-29 21:46:20 +01:00
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
qttools
wrapQtAppsHook
pkg-config
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
botan3
libgit2
] ++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ];
2023-05-26 08:29:29 +02:00
cmakeFlags = [
"-DQON_QT6_BUILD=ON"
"-DBUILD_WITH_SYSTEM_BOTAN=ON"
"-DBUILD_WITH_LIBGIT2=ON"
];
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)
''
# Install shell completion on macOS
+ lib.optionalString stdenv.isDarwin ''
installShellCompletion --cmd ${pname} \
--bash <($out/bin/${appname} --completion bash) \
--fish <($out/bin/${appname} --completion fish)
''
# Create a lowercase symlink for Linux
+ lib.optionalString stdenv.hostPlatform.isLinux ''
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
];
2023-05-26 08:29:29 +02:00
platforms = platforms.unix;
};
}