2023-05-30 11:39:25 +02:00
|
|
|
{ stdenv, lib, fetchFromGitHub, postgresql, boost182, nixosTests }:
|
|
|
|
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
let
|
2023-05-30 11:39:25 +02:00
|
|
|
version = "1.6.0";
|
|
|
|
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
main_src = fetchFromGitHub {
|
|
|
|
name = "datasketches-postgresql";
|
|
|
|
owner = "apache";
|
|
|
|
repo = "datasketches-postgresql";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-sz94fIe7nyWhjiw8FAm6ZzVpB0sAK5YxUrtbaZt/guA=";
|
|
|
|
};
|
|
|
|
|
|
|
|
cpp_src = fetchFromGitHub {
|
|
|
|
name = "datasketches-cpp";
|
|
|
|
owner = "apache";
|
|
|
|
repo = "datasketches-cpp";
|
|
|
|
rev = "refs/tags/4.1.0";
|
|
|
|
hash = "sha256-vPoFzRxOXlEAiiHH9M5S6255ahzaKsGNYS0cdHwrRYw=";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "apache_datasketches";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
srcs = [ main_src cpp_src ];
|
|
|
|
|
|
|
|
sourceRoot = main_src.name;
|
2023-05-30 11:39:25 +02:00
|
|
|
|
|
|
|
buildInputs = [ postgresql boost182 ];
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
runHook prePatch
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
cp -r ../${cpp_src.name} .
|
2023-05-30 11:39:25 +02:00
|
|
|
runHook postPatch
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
install -D -m 644 ./datasketches.so -t $out/lib/
|
|
|
|
cat \
|
|
|
|
sql/datasketches_cpc_sketch.sql \
|
|
|
|
sql/datasketches_kll_float_sketch.sql \
|
|
|
|
sql/datasketches_kll_double_sketch.sql \
|
|
|
|
sql/datasketches_theta_sketch.sql \
|
|
|
|
sql/datasketches_frequent_strings_sketch.sql \
|
|
|
|
sql/datasketches_hll_sketch.sql \
|
|
|
|
sql/datasketches_aod_sketch.sql \
|
|
|
|
sql/datasketches_req_float_sketch.sql \
|
|
|
|
sql/datasketches_quantiles_double_sketch.sql \
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
> sql/datasketches--${version}.sql
|
2023-05-30 11:39:25 +02:00
|
|
|
install -D -m 644 ./datasketches.control -t $out/share/postgresql/extension
|
|
|
|
install -D -m 644 \
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
./sql/datasketches--${version}.sql \
|
2023-05-30 11:39:25 +02:00
|
|
|
./sql/datasketches--1.3.0--1.4.0.sql \
|
|
|
|
./sql/datasketches--1.4.0--1.5.0.sql \
|
|
|
|
./sql/datasketches--1.5.0--1.6.0.sql \
|
|
|
|
-t $out/share/postgresql/extension
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.apache_datasketches = nixosTests.apache_datasketches;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "PostgreSQL extension providing approximate algorithms for distinct item counts, quantile estimation and frequent items detection";
|
|
|
|
longDescription = ''
|
|
|
|
apache_datasketches is an extension to support approximate algorithms on PostgreSQL. The implementation
|
|
|
|
is based on the Apache Datasketches CPP library, and provides support for HyperLogLog,
|
|
|
|
Compressed Probabilistic Counting, KLL, Frequent strings, and Theta sketches.
|
|
|
|
'';
|
|
|
|
homepage = "https://datasketches.apache.org/";
|
|
|
|
platforms = postgresql.meta.platforms;
|
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = with lib.maintainers; [ mmusnjak ];
|
|
|
|
};
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
}
|