at master 2.4 kB view raw
1{ 2 bison, 3 fetchFromGitHub, 4 flex, 5 lib, 6 perl, 7 postgresql, 8 postgresqlBuildExtension, 9 stdenv, 10}: 11 12let 13 hashes = { 14 # Issue tracking PostgreSQL 17 support: https://github.com/apache/age/issues/2111 15 # "17" = ""; 16 "16" = "sha256-sXh/vmGyYj00ALfFVdeql2DZ6nCJQDNKyNgzlOZnPAw="; 17 "15" = "sha256-webZWgWZGnSoXwTpk816tjbtHV1UIlXkogpBDAEL4gM="; 18 "14" = "sha256-jZXhcYBubpjIJ8M5JHXKV5f6VK/2BkypH3P7nLxZz3E="; 19 "13" = "sha256-HR6nnWt/V2a0rD5eHHUsFIZ1y7lmvLz36URt9pPJnCw="; 20 }; 21in 22postgresqlBuildExtension (finalAttrs: { 23 pname = "age"; 24 version = "1.5.0-rc0"; 25 26 src = fetchFromGitHub { 27 owner = "apache"; 28 repo = "age"; 29 tag = "PG${lib.versions.major postgresql.version}/v${ 30 builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version 31 }"; 32 hash = 33 hashes.${lib.versions.major postgresql.version} 34 or (throw "Source for Age is not available for ${postgresql.version}"); 35 }; 36 37 makeFlags = [ 38 "BISON=${bison}/bin/bison" 39 "FLEX=${flex}/bin/flex" 40 "PERL=${perl}/bin/perl" 41 ]; 42 43 enableUpdateScript = false; 44 passthru.tests = stdenv.mkDerivation { 45 inherit (finalAttrs) version src; 46 47 pname = "age-regression"; 48 49 dontConfigure = true; 50 51 buildPhase = 52 let 53 postgresqlAge = postgresql.withPackages (_: [ finalAttrs.finalPackage ]); 54 in 55 '' 56 # The regression tests need to be run in the order specified in the Makefile. 57 echo -e "include Makefile\nfiles:\n\t@echo \$(REGRESS)" > Makefile.regress 58 REGRESS_TESTS=$(make -f Makefile.regress files) 59 60 ${lib.getDev postgresql}/lib/pgxs/src/test/regress/pg_regress \ 61 --inputdir=./ \ 62 --bindir='${postgresqlAge}/bin' \ 63 --encoding=UTF-8 \ 64 --load-extension=age \ 65 --inputdir=./regress --outputdir=./regress --temp-instance=./regress/instance \ 66 --port=61958 --dbname=contrib_regression \ 67 $REGRESS_TESTS 68 ''; 69 70 installPhase = '' 71 touch $out 72 ''; 73 }; 74 75 meta = { 76 broken = !builtins.elem (lib.versions.major postgresql.version) (builtins.attrNames hashes); 77 description = "Graph database extension for PostgreSQL"; 78 homepage = "https://age.apache.org/"; 79 changelog = "https://github.com/apache/age/raw/v${finalAttrs.src.rev}/RELEASE"; 80 maintainers = [ ]; 81 platforms = postgresql.meta.platforms; 82 license = lib.licenses.asl20; 83 }; 84})