2024-11-23 05:10:31 +00:00
|
|
|
{
|
2025-03-16 20:08:54 +01:00
|
|
|
boost186,
|
2024-11-23 05:10:31 +00:00
|
|
|
fetchFromGitHub,
|
2025-03-16 20:08:54 +01:00
|
|
|
lib,
|
2024-11-23 05:10:31 +00:00
|
|
|
postgresql,
|
2025-03-16 21:28:21 +01:00
|
|
|
postgresqlBuildExtension,
|
2024-11-23 05:10:31 +00:00
|
|
|
postgresqlTestExtension,
|
2025-03-16 20:08:54 +01:00
|
|
|
stdenv,
|
2024-11-23 05:10:31 +00:00
|
|
|
}:
|
2023-05-30 11:39:25 +02:00
|
|
|
|
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
|
2024-04-04 15:21:59 +02:00
|
|
|
version = "1.7.0";
|
2023-05-30 11:39:25 +02:00
|
|
|
|
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";
|
2025-03-16 20:08:54 +01:00
|
|
|
tag = version;
|
2024-04-04 15:21:59 +02:00
|
|
|
hash = "sha256-W41uAs3W4V7c9O/wBw3rut65bcmY8EdQS1/tPszMGqA=";
|
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
|
|
|
};
|
|
|
|
|
|
|
|
cpp_src = fetchFromGitHub {
|
|
|
|
name = "datasketches-cpp";
|
|
|
|
owner = "apache";
|
|
|
|
repo = "datasketches-cpp";
|
2025-03-16 20:08:54 +01:00
|
|
|
tag = "5.0.2";
|
2024-04-04 15:21:59 +02:00
|
|
|
hash = "sha256-yGk1OckYipAgLTQK6w6p6EdHMxBIQSjPV/MMND3cDks=";
|
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
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2025-03-16 21:28:21 +01:00
|
|
|
postgresqlBuildExtension (finalAttrs: {
|
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
|
|
|
pname = "apache_datasketches";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
srcs = [
|
|
|
|
main_src
|
|
|
|
cpp_src
|
|
|
|
];
|
|
|
|
|
|
|
|
sourceRoot = main_src.name;
|
2023-05-30 11:39:25 +02:00
|
|
|
|
2025-02-01 10:24:55 +01:00
|
|
|
# fails to build with boost 1.87
|
|
|
|
buildInputs = [ boost186 ];
|
2023-05-30 11:39:25 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2024-11-15 21:44:56 +01:00
|
|
|
enableUpdateScript = false;
|
2024-11-01 19:56:51 +01:00
|
|
|
passthru.tests.extension = postgresqlTestExtension {
|
|
|
|
inherit (finalAttrs) finalPackage;
|
|
|
|
sql = ''
|
|
|
|
CREATE EXTENSION datasketches;
|
|
|
|
SELECT hll_sketch_to_string(hll_sketch_build(1));
|
|
|
|
'';
|
|
|
|
};
|
2023-05-30 11:39:25 +02:00
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
2024-11-01 19:56:51 +01:00
|
|
|
})
|