lol
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 libsForQt5,
8 sqlcipher,
9}:
10
11let
12 qt' = libsForQt5; # upstream has adopted qt6, but no released version supports it
13
14in
15stdenv.mkDerivation (finalAttrs: {
16 pname = "sqlitebrowser";
17 version = "3.13.1";
18
19 src = fetchFromGitHub {
20 owner = "sqlitebrowser";
21 repo = "sqlitebrowser";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-bpZnO8i8MDgOm0f93pBmpy1sZLJQ9R4o4ZLnGfT0JRg=";
24 };
25
26 patches = lib.optional stdenv.hostPlatform.isDarwin ./macos.patch;
27
28 postPatch = ''
29 substituteInPlace CMakeLists.txt \
30 --replace-fail '"Unknown"' '"${finalAttrs.src.rev}"'
31 '';
32
33 buildInputs = [
34 qt'.qtbase
35 qt'.qcustomplot
36 qt'.qscintilla
37 sqlcipher
38 ]
39 ++ lib.optional stdenv.hostPlatform.isDarwin qt'.qtmacextras;
40
41 nativeBuildInputs = [
42 cmake
43 pkg-config
44 qt'.qttools
45 qt'.wrapQtAppsHook
46 ];
47
48 cmakeFlags = [
49 "-Wno-dev"
50 (lib.cmakeBool "sqlcipher" true)
51 (lib.cmakeBool "ENABLE_TESTING" (finalAttrs.finalPackage.doCheck or false))
52 (lib.cmakeBool "FORCE_INTERNAL_QSCINTILLA" false)
53 (lib.cmakeBool "FORCE_INTERNAL_QCUSTOMPLOT" false)
54 (lib.cmakeBool "FORCE_INTERNAL_QHEXEDIT" true) # TODO: package qhexedit
55 (lib.cmakeFeature "QSCINTILLA_INCLUDE_DIR" "${lib.getDev qt'.qscintilla}/include")
56 ];
57
58 env.LANG = "C.UTF-8";
59
60 doCheck = true;
61
62 meta = {
63 description = "DB Browser for SQLite";
64 mainProgram = "sqlitebrowser";
65 homepage = "https://sqlitebrowser.org/";
66 license = lib.licenses.gpl3;
67 maintainers = with lib.maintainers; [ peterhoeg ];
68 platforms = lib.platforms.unix;
69 };
70})