36 lines
1017 B
Nix
36 lines
1017 B
Nix
{ self, pkgs }:
|
|
let
|
|
sqlite-example-exts-static = pkgs.callPackage ./util/sqlite-example-exts-static.nix { };
|
|
|
|
sqlite-with-static-exts = self.mkSqlite {
|
|
inherit pkgs;
|
|
|
|
extensions = [
|
|
{
|
|
library = "${sqlite-example-exts-static}/lib/libaddext.a";
|
|
init = "sqlite3_addext_init";
|
|
}
|
|
{
|
|
library = "${sqlite-example-exts-static}/lib/libsubext.a";
|
|
init = "sqlite3_subext_init";
|
|
}
|
|
{
|
|
library = "${sqlite-example-exts-static}/lib/libmultext.a";
|
|
init = "sqlite3_multext_init";
|
|
}
|
|
];
|
|
};
|
|
in
|
|
pkgs.runCommand "test-sqlite-with-static-exts" {
|
|
nativeBuildInputs = [ sqlite-with-static-exts.sqlite-cli ];
|
|
|
|
passthru = {
|
|
inherit sqlite-example-exts-static;
|
|
inherit sqlite-with-static-exts;
|
|
};
|
|
} ''
|
|
mkdir -p "$out"
|
|
sqlite3 :memory: <<<"SELECT myadd(1, 2), mysub(5, 3), mymult(4, 6);" | tee "$out/test.log"
|
|
grep -q -F "3|2|24" "$out/test.log" || (echo "Unexpected output from sqlite3 with static extensions" && exit 1)
|
|
''
|