nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 # Fix build with CMake 4
33 # Will be part of the Qt6 port
34 # Note: The vendored version of qhexedit is incompatible with our qhexedit2: https://github.com/sqlitebrowser/sqlitebrowser/issues/1808
35 + ''
36 substituteInPlace libs/qhexedit/CMakeLists.txt \
37 --replace-fail 'cmake_minimum_required(VERSION 2.8.12.2)' 'cmake_minimum_required(VERSION 3.16)'
38 '';
39
40 buildInputs = [
41 qt'.qtbase
42 qt'.qcustomplot
43 qt'.qscintilla
44 sqlcipher
45 ]
46 ++ lib.optional stdenv.hostPlatform.isDarwin qt'.qtmacextras;
47
48 nativeBuildInputs = [
49 cmake
50 pkg-config
51 qt'.qttools
52 qt'.wrapQtAppsHook
53 ];
54
55 cmakeFlags = [
56 "-Wno-dev"
57 (lib.cmakeBool "sqlcipher" true)
58 (lib.cmakeBool "ENABLE_TESTING" (finalAttrs.finalPackage.doCheck or false))
59 (lib.cmakeBool "FORCE_INTERNAL_QSCINTILLA" false)
60 (lib.cmakeBool "FORCE_INTERNAL_QCUSTOMPLOT" false)
61 (lib.cmakeBool "FORCE_INTERNAL_QHEXEDIT" true) # TODO: package qhexedit
62 (lib.cmakeFeature "QSCINTILLA_INCLUDE_DIR" "${lib.getDev qt'.qscintilla}/include")
63 ];
64
65 env.LANG = "C.UTF-8";
66
67 doCheck = true;
68
69 meta = {
70 description = "DB Browser for SQLite";
71 mainProgram = "sqlitebrowser";
72 homepage = "https://sqlitebrowser.org/";
73 license = lib.licenses.gpl3;
74 maintainers = with lib.maintainers; [ peterhoeg ];
75 platforms = lib.platforms.unix;
76 };
77})