lol
1{ lib
2, stdenv
3, fetchurl
4, qmake
5, qttools
6, qtbase
7, qtdeclarative
8, qtsvg
9, qtwayland
10, qtwebsockets
11, qt5compat
12, makeWrapper
13, wrapQtAppsHook
14, botan2
15, pkg-config
16, nixosTests
17}:
18
19let
20 pname = "qownnotes";
21 appname = "QOwnNotes";
22 version = "23.11.1";
23in
24stdenv.mkDerivation {
25 inherit pname appname version;
26
27 src = fetchurl {
28 url = "https://github.com/pbek/QOwnNotes/releases/download/v${version}/qownnotes-${version}.tar.xz";
29 hash = "sha256-rsYB8aLVVpGGbiEDWCpGCPdZEsOajoGfoh6YYxilxpg=";
30 };
31
32 nativeBuildInputs = [
33 qmake
34 qttools
35 wrapQtAppsHook
36 pkg-config
37 ] ++ lib.optionals stdenv.isDarwin [ makeWrapper ];
38
39 buildInputs = [
40 qtbase
41 qtdeclarative
42 qtsvg
43 qtwebsockets
44 qt5compat
45 botan2
46 ] ++ lib.optionals stdenv.isLinux [ qtwayland ];
47
48 qmakeFlags = [
49 "USE_SYSTEM_BOTAN=1"
50 ];
51
52 postInstall =
53 # Create a lowercase symlink for Linux
54 lib.optionalString stdenv.isLinux ''
55 ln -s $out/bin/${appname} $out/bin/${pname}
56 ''
57 # Wrap application for macOS as lowercase binary
58 + lib.optionalString stdenv.isDarwin ''
59 mkdir -p $out/Applications
60 mv $out/bin/${appname}.app $out/Applications
61 makeWrapper $out/Applications/${appname}.app/Contents/MacOS/${appname} $out/bin/${pname}
62 '';
63
64 # Tests QOwnNotes using the NixOS module by launching xterm:
65 passthru.tests.basic-nixos-module-functionality = nixosTests.qownnotes;
66
67 meta = with lib; {
68 description = "Plain-text file notepad and todo-list manager with markdown support and Nextcloud/ownCloud integration";
69 homepage = "https://www.qownnotes.org/";
70 changelog = "https://www.qownnotes.org/changelog.html";
71 downloadPage = "https://github.com/pbek/QOwnNotes/releases/tag/v${version}";
72 license = licenses.gpl2Only;
73 maintainers = with maintainers; [ pbek totoroot ];
74 platforms = platforms.unix;
75 };
76}