{ lib, static ? false, src, version, nameSuffix, stdenv, unzip, zlib, icu, amalgamate ? true, coreInitExt ? null, features ? { }, featureFlags ? [ ], enableInteractive ? false, ... }: stdenv.mkDerivation (finalAttrs: { pname = "sqlite${nameSuffix}"; inherit version src; nativeBuildInputs = [ unzip ]; 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 = [ "--bindir=/tmp" "--mandir=/tmp" "--includedir=${placeholder "out"}/include" "--libdir=${placeholder "out"}/lib" "--${if static then "disable" else "enable"}-shared" "--${if static then "enable" else "disable"}-static" "--${if amalgamate then "enable" else "disable"}-amalgamation" ] ++ lib.optional features.ENABLE_ICU [ "--enable-icu-collations" "--with-icu-config=${lib.getExe' icu.dev "icu-config"}" ]; makeFlags = (coreInitExt.passthru.makeFlags or [ ]) ++ map (opt: "OPTIONS+=${lib.escapeShellArg opt}") featureFlags ++ [ (if static then "lib" else "so") ]; env.NIX_CFLAGS_LINK = lib.optionalString features.ENABLE_FTS5 "-lm"; env.NIX_LDFLAGS = lib.concatStringsSep " " (coreInitExt.passthru.extraLDFLAGS or [ ]); })