Render headers as their own derivation

This commit is contained in:
2026-05-19 22:02:03 +09:00
parent 9cd0e995bd
commit be6364c281
2 changed files with 74 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
{
lib,
src,
version,
nameSuffix,
stdenv,
unzip,
tcl,
zlib,
icu,
features ? { },
featureFlags ? [ ],
...
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sqlite-amalgamation${nameSuffix}";
inherit version src;
nativeBuildInputs = [
unzip
tcl
];
buildInputs = [
zlib
] ++ lib.optional features.ENABLE_ICU [
icu
];
# required for aarch64 but applied for all arches for simplicity
preConfigure = ''
patchShebangs configure
'';
# sqlite relies on autosetup now; so many of the
# previously-understood flags are gone. They should instead be set
# on a per-output basis.
setOutputFlags = false;
configureFlags = lib.optional features.ENABLE_ICU [
"--enable-icu-collations"
"--with-icu-config=${lib.getExe' icu.dev "icu-config"}"
];
env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " featureFlags;
env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm";
makeFlags = [ "sqlite3.h" ];
installPhase = ''
runHook preInstall
install -Dm444 sqlite3.h src/sqlite3ext.h -t "$out/include"
runHook postInstall
'';
})
+11
View File
@@ -63,6 +63,15 @@ let
(x: if x == "" then "" else "-${x}")
];
headers = pkgs.callPackage ./headers.nix ({
inherit version src;
inherit amalgamate;
inherit features;
inherit extensions;
inherit extraLibraries;
nameSuffix = suffix;
} // config);
coreInitExt = if extensions == [ ]
then null
else pkgs.callPackage ./core-init-ext.nix ({
@@ -76,6 +85,8 @@ in {
_suffix = suffix;
_coreInitExt = coreInitExt;
inherit headers;
sqlite = pkgs.callPackage ./sqlite.nix ({
inherit version src;
inherit amalgamate;