Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 50 lines 1.3 kB view raw
1{ 2 fetchFromGitHub, 3 file, 4 lib, 5 postgresql, 6 postgresqlBuildExtension, 7 postgresqlTestExtension, 8}: 9 10postgresqlBuildExtension (finalAttrs: { 11 pname = "pg_byteamagic"; 12 version = "0.2.4"; 13 14 src = fetchFromGitHub { 15 owner = "nmandery"; 16 repo = "pg_byteamagic"; 17 tag = "v${finalAttrs.version}"; 18 hash = "sha256-0RRElMMVUm3cXLI7G3SkIVr8yA/Rk3gBsgXG+EFU3CI="; 19 }; 20 21 buildInputs = [ 22 file 23 ]; 24 25 passthru.tests = { 26 extension = postgresqlTestExtension { 27 inherit (finalAttrs) finalPackage; 28 sql = '' 29 CREATE EXTENSION byteamagic; 30 SELECT byteamagic_mime('test'); 31 ''; 32 asserts = [ 33 { 34 query = "SELECT byteamagic_mime('test')"; 35 expected = "'text/plain'"; 36 description = "`byteamagic_mime(...) should return proper mimetype."; 37 } 38 ]; 39 }; 40 }; 41 42 meta = { 43 description = "PostgreSQL extension to determinate the filetypes of bytea BLOBs"; 44 homepage = "https://github.com/nmandery/pg_byteamagic"; 45 changelog = "https://raw.githubusercontent.com/nmandery/pg_byteamagic/refs/tags/v${finalAttrs.version}/Changes"; 46 license = lib.licenses.bsd2WithViews; 47 teams = [ lib.teams.apm ]; 48 platforms = postgresql.meta.platforms; 49 }; 50})