diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix index 3647516c803..4393b631461 100644 --- a/pkgs/development/libraries/sqlite/default.nix +++ b/pkgs/development/libraries/sqlite/default.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { pname = "sqlite"; version = "3.33.0"; - # NB! Make sure to update analyzer.nix src (in the same directory). + # NB! Make sure to update ./tools.nix src (in the same directory). src = fetchurl { url = "https://sqlite.org/2020/sqlite-autoconf-${archiveVersion version}.tar.gz"; sha256 = "05dvdfaxd552gj5p7k0i72sfam7lykaw1g2pfn52jnppqx42qshh"; diff --git a/pkgs/development/libraries/sqlite/tools.nix b/pkgs/development/libraries/sqlite/tools.nix new file mode 100644 index 00000000000..3ac1f617862 --- /dev/null +++ b/pkgs/development/libraries/sqlite/tools.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchurl, unzip, sqlite, tcl, Foundation }: + +let + archiveVersion = import ./archive-version.nix stdenv.lib; + mkTool = { pname, makeTarget, description, homepage }: stdenv.mkDerivation rec { + inherit pname; + version = "3.33.0"; + + src = assert version == sqlite.version; fetchurl { + url = "https://sqlite.org/2020/sqlite-src-${archiveVersion version}.zip"; + sha256 = "1f09srlrmcab1sf8j2d89s2kvknlbxk7mbsiwpndw9mall27dgwh"; + }; + + nativeBuildInputs = [ unzip ]; + buildInputs = [ tcl ] ++ stdenv.lib.optional stdenv.isDarwin Foundation; + + makeFlags = [ makeTarget ]; + + installPhase = "install -Dt $out/bin ${makeTarget}"; + + meta = with stdenv.lib; { + inherit description homepage; + downloadPage = http://sqlite.org/download.html; + license = licenses.publicDomain; + maintainers = with maintainers; [ pesterhazy johnazoidberg ]; + platforms = platforms.unix; + }; + }; +in +{ + sqldiff = mkTool { + pname = "sqldiff"; + makeTarget = "sqldiff"; + description = "A tool that displays the differences between SQLite databases"; + homepage = "https://www.sqlite.org/sqldiff.html"; + }; + sqlite-analyzer = mkTool { + pname = "sqlite-analyzer"; + makeTarget = "sqlite3_analyzer"; + description = "A tool that shows statistics about SQLite databases"; + homepage = "https://www.sqlite.org/sqlanalyze.html"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 07625de358c..04e0f41e13e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15415,7 +15415,9 @@ in sqlite = lowPrio (callPackage ../development/libraries/sqlite { }); - sqlite-analyzer = lowPrio (callPackage ../development/libraries/sqlite/analyzer.nix { }); + inherit (callPackage ../development/libraries/sqlite/tools.nix { + inherit (darwin.apple_sdk.frameworks) Foundation; + }) sqlite-analyzer sqldiff; sqlar = callPackage ../development/libraries/sqlite/sqlar.nix { };