lol

pgjwt: init at 0.0.1 (#22644)

authored by

Tomasz Czyż and committed by
Franz Pletz
0b27c74e 488ece81

+70
+1
nixos/release.nix
··· 286 286 tests.pam-oath-login = callTest tests/pam-oath-login.nix {}; 287 287 #tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; }); 288 288 tests.peerflix = callTest tests/peerflix.nix {}; 289 + tests.pgjwt = callTest tests/pgjwt.nix {}; 289 290 tests.postgresql = callTest tests/postgresql.nix {}; 290 291 tests.printing = callTest tests/printing.nix {}; 291 292 tests.proxy = callTest tests/proxy.nix {};
+42
nixos/tests/pgjwt.nix
··· 1 + import ./make-test.nix ({ pkgs, ...} : 2 + let 3 + test = pkgs.writeText "test.sql" '' 4 + CREATE EXTENSION pgcrypto; 5 + CREATE EXTENSION pgjwt; 6 + select sign('{"sub":"1234567890","name":"John Doe","admin":true}', 'secret'); 7 + select * from verify('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ', 'secret'); 8 + ''; 9 + in 10 + { 11 + name = "pgjwt"; 12 + meta = with pkgs.stdenv.lib.maintainers; { 13 + maintainers = [ spinus ]; 14 + }; 15 + 16 + nodes = { 17 + master = 18 + { pkgs, config, ... }: 19 + 20 + { 21 + services.postgresql = let mypg = pkgs.postgresql95; in { 22 + enable = true; 23 + package = mypg; 24 + extraPlugins =[pkgs.pgjwt]; 25 + initialScript = pkgs.writeText "postgresql-init.sql" 26 + '' 27 + CREATE ROLE postgres WITH superuser login createdb; 28 + ''; 29 + }; 30 + }; 31 + }; 32 + 33 + testScript = '' 34 + startAll; 35 + $master->waitForUnit("postgresql"); 36 + $master->succeed("timeout 10 bash -c 'while ! psql postgres -c \"SELECT 1;\";do sleep 1;done;'"); 37 + $master->succeed("cat ${test} | psql postgres"); 38 + # I can't make original test working :[ 39 + # $master->succeed("${pkgs.perlPackages.TAPParserSourceHandlerpgTAP}/bin/pg_prove -d postgres ${pkgs.pgjwt.src}/test.sql"); 40 + 41 + ''; 42 + })
+25
pkgs/servers/sql/postgresql/pgjwt/default.nix
··· 1 + { stdenv, fetchFromGitHub }: 2 + stdenv.mkDerivation rec { 3 + name = "pgjwt-${version}"; 4 + version = "0.0.1"; 5 + src = fetchFromGitHub { 6 + owner = "michelp"; 7 + repo = "pgjwt"; 8 + rev = "12a41eef15e6d3a22399e03178560d5174d496a3"; 9 + sha256 = "1dgx7kqkf9d7j5qj3xykx238xm8jg0s6c8h7zyl4lx8dmbz9sgsv"; 10 + }; 11 + dontBuild = true; 12 + installPhase = '' 13 + mkdir -p $out/bin # current postgresql extension mechanism in nixos requires bin directory 14 + mkdir -p $out/share/extension 15 + cp pg*sql *.control $out/share/extension 16 + ''; 17 + meta = with stdenv.lib; { 18 + description = "PostgreSQL implementation of JSON Web Tokens"; 19 + longDescription = '' 20 + sign() and verify() functions to create and verify JSON Web Tokens. 21 + ''; 22 + license = licenses.mit; 23 + maintainers = with maintainers; [spinus]; 24 + }; 25 + }
+2
pkgs/top-level/all-packages.nix
··· 2141 2141 2142 2142 pgf_graphics = callPackage ../tools/graphics/pgf { }; 2143 2143 2144 + pgjwt = callPackage ../servers/sql/postgresql/pgjwt {}; 2145 + 2144 2146 pigz = callPackage ../tools/compression/pigz { }; 2145 2147 2146 2148 pixz = callPackage ../tools/compression/pixz { };