File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 129129 ./nix/ext/pg_hashids.nix
130130 ./nix/ext/pgsodium.nix
131131 ./nix/ext/pg_graphql.nix
132+ ./nix/ext/pg_mooncake.nix
132133 ./nix/ext/pg_stat_monitor.nix
133134 ./nix/ext/pg_jsonschema.nix
134135 ./nix/ext/pgvector.nix
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ stdenv ,
4+ fetchFromGitHub ,
5+ postgresql ,
6+ cmake ,
7+ openssl ,
8+ curl ,
9+ pkg-config ,
10+ cargo ,
11+ rustc ,
12+ cacert ,
13+ } :
14+
15+ stdenv . mkDerivation rec {
16+ pname = "pg_mooncake" ;
17+ version = "61a2c495ba8e8bbcf59142f05dc85a3059bdf42c" ;
18+
19+ src = fetchFromGitHub {
20+ owner = "olirice" ;
21+ repo = pname ;
22+ rev = version ;
23+ hash = "sha256-zyQ0LREOSIF+25NODoZb8fTVH0sYEVu5YUqsJigWEb8=" ;
24+ fetchSubmodules = true ;
25+ } ;
26+
27+ # Tools needed for building:
28+ nativeBuildInputs = [
29+ cargo
30+ rustc
31+ cmake
32+ pkg-config
33+ ] ;
34+
35+ buildInputs = [
36+ postgresql
37+ openssl
38+ curl
39+ cacert
40+ ] ;
41+
42+ # Skip the default configure phase because there's no top-level CMakeLists.txt.
43+ dontConfigure = true ;
44+
45+ # Use "make release -j" with Nix's parallel build cores:
46+ buildPhase = ''
47+ export SSL_CERT_FILE=${ cacert } /etc/ssl/certs/ca-bundle.crt
48+
49+ # Make sure these env vars are set in the same shell invocation:
50+ export HOME=$PWD/home
51+ export CARGO_HOME=$HOME/cargo
52+ mkdir -p "$CARGO_HOME"
53+
54+ # Pass HOME and CARGO_HOME explicitly to `make`, in case the upstream
55+ # Makefile does something like `HOME ?= /homeless-shelter`.
56+ HOME="$HOME" \
57+ CARGO_HOME="$CARGO_HOME" \
58+ make release -j$NIX_BUILD_CORES PG_CONFIG="${ postgresql } /bin/pg_config"
59+ '' ;
60+
61+ installPhase = ''
62+ mkdir -p $out/{lib,share/postgresql/extension}
63+
64+ cp *${ postgresql . dlSuffix } $out/lib
65+ cp *.sql $out/share/postgresql/extension
66+ '' ;
67+
68+ meta = with lib ; {
69+ description = "Mooncake: user-defined pipeline analytics in Postgres" ;
70+ homepage = "https://github.com/Mooncake-Labs/${ pname } " ;
71+ platforms = postgresql . meta . platforms ;
72+ license = licenses . postgresql ;
73+ } ;
74+ }
You can’t perform that action at this time.
0 commit comments