From 0b5b80956ab8e5db7be6890558849af9701b2ab2 Mon Sep 17 00:00:00 2001 From: Anton Tetov Johansson Date: Mon, 29 Jun 2026 15:53:16 +0200 Subject: [PATCH] sqlite_modern_cpp: init at 3.2-unstable-2023-12-03 Adding header only library sqlite_modern_cpp with the ultimate goal to replace the vendored headers in pkgs/by-name/li/libdjinterop. CMake builds tests and could be skipped. Tested with libdjinterop in https://github.com/NixOS/nixpkgs/pull/536693 --- pkgs/by-name/sq/sqlite-modern-cpp/package.nix | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 pkgs/by-name/sq/sqlite-modern-cpp/package.nix diff --git a/pkgs/by-name/sq/sqlite-modern-cpp/package.nix b/pkgs/by-name/sq/sqlite-modern-cpp/package.nix new file mode 100644 index 000000000000..e95395cf7338 --- /dev/null +++ b/pkgs/by-name/sq/sqlite-modern-cpp/package.nix @@ -0,0 +1,70 @@ +{ + lib, + stdenv, + fetchFromGitHub, + + catch2, + cmake, + sqlite, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "sqlite-modern-cpp"; + version = "3.2-unstable-2023-12-03"; + + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "SqliteModernCpp"; + repo = "sqlite_modern_cpp"; + rev = "6e3009973025e0016d5573529067714201338c80"; + hash = "sha256-DD1EV3rBWe813TEHpa8nCnwHQjUizB5NOx5uGep5tJc="; + }; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + catch2 + sqlite + ]; + + strictDeps = true; + + cmakeFlags = [ + (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.5") + (lib.cmakeBool "HUNTER_ENABLED" false) + ]; + + doCheck = true; + + dontUseCmakeInstall = true; + + preConfigure = '' + substituteInPlace CMakeLists.txt \ + --replace-fail 'find_package(sqlite3 CONFIG REQUIRED)' \ + 'find_package(SQLite3 REQUIRED)' \ + --replace-fail 'sqlite3::sqlite3' 'SQLite::SQLite3' + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/include + cp -r $src/hdr/. $out/include/ + + runHook postInstall + ''; + + meta = { + description = "Lightweight C++ wrapper around sqlite3 C api"; + homepage = "https://github.com/SqliteModernCpp/sqlite_modern_cpp"; + # no changelog for unstable version, change to + # https://github.com/SqliteModernCpp/sqlite_modern_cpp/releases/tag/v${finalAttrs.version} + # if there are new releases in the future + changelog = "https://github.com/SqliteModernCpp/sqlite_modern_cpp/releases"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ tetov ]; + }; +})