1{ lib, stdenv, fetchurl, unzip, sqlite, tcl, Foundation }:
2
3let
4 archiveVersion = import ./archive-version.nix lib;
5 mkTool = { pname, makeTarget, description, homepage, mainProgram }: stdenv.mkDerivation rec {
6 inherit pname;
7 version = "3.41.2";
8
9 # nixpkgs-update: no auto update
10 src = assert version == sqlite.version; fetchurl {
11 url = "https://sqlite.org/2023/sqlite-src-${archiveVersion version}.zip";
12 hash = "sha256-hxkfzsuLcH2aEO2xNgdoYxfXFpwIC5vcXTnQY1g3bMw=";
13 };
14
15 nativeBuildInputs = [ unzip ];
16 buildInputs = [ tcl ] ++ lib.optional stdenv.isDarwin Foundation;
17
18 makeFlags = [ makeTarget ];
19
20 installPhase = "install -Dt $out/bin ${makeTarget}";
21
22 meta = with lib; {
23 inherit description homepage mainProgram;
24 downloadPage = "http://sqlite.org/download.html";
25 license = licenses.publicDomain;
26 maintainers = with maintainers; [ johnazoidberg ];
27 platforms = platforms.unix;
28 };
29 };
30in
31{
32 sqldiff = mkTool {
33 pname = "sqldiff";
34 makeTarget = "sqldiff";
35 description = "A tool that displays the differences between SQLite databases";
36 homepage = "https://www.sqlite.org/sqldiff.html";
37 mainProgram = "sqldiff";
38 };
39 sqlite-analyzer = mkTool {
40 pname = "sqlite-analyzer";
41 makeTarget = "sqlite3_analyzer";
42 description = "A tool that shows statistics about SQLite databases";
43 homepage = "https://www.sqlite.org/sqlanalyze.html";
44 mainProgram = "sqlite3_analyzer";
45 };
46}