1{
2 fetchFromGitHub,
3 lib,
4 nixosTests,
5 postgresql,
6 postgresqlBuildExtension,
7 postgresqlTestExtension,
8 unstableGitUpdater,
9}:
10
11postgresqlBuildExtension (finalAttrs: {
12 pname = "pgjwt";
13 version = "0-unstable-2023-03-02";
14
15 src = fetchFromGitHub {
16 owner = "michelp";
17 repo = "pgjwt";
18 rev = "f3d82fd30151e754e19ce5d6a06c71c20689ce3d";
19 hash = "sha256-nDZEDf5+sFc1HDcG2eBNQj+kGcdAYRXJseKi9oww+JU=";
20 };
21
22 passthru.updateScript = unstableGitUpdater { };
23
24 passthru.tests = lib.recurseIntoAttrs {
25 pgjwt = nixosTests.postgresql.pgjwt.passthru.override postgresql;
26
27 extension = postgresqlTestExtension {
28 inherit (finalAttrs) finalPackage;
29 sql = ''
30 CREATE EXTENSION pgjwt CASCADE;
31 SELECT sign('{"sub":"1234567890","name":"John Doe","admin":true}', 'secret');
32 '';
33 };
34 };
35
36 meta = {
37 description = "PostgreSQL implementation of JSON Web Tokens";
38 longDescription = ''
39 sign() and verify() functions to create and verify JSON Web Tokens.
40 '';
41 license = lib.licenses.mit;
42 platforms = postgresql.meta.platforms;
43 maintainers = with lib.maintainers; [ spinus ];
44 };
45})