summaryrefslogtreecommitdiff
path: root/pkgs/servers/sql/postgresql/ext/plpython3.nix
blob: 32f2ffd3c89a583a8fb58093381846c801303901 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  buildEnv,
  postgresql,
  postgresqlTestExtension,
  python3,
}:

let
  withPackages =
    f:
    let
      python = python3.withPackages f;
      finalPackage = buildEnv {
        name = "${postgresql.pname}-plpython3-${postgresql.version}";
        paths = [ postgresql.plpython3 ];
        passthru = {
          inherit withPackages;
          wrapperArgs = [
            ''--set PYTHONPATH "${python}/${python.sitePackages}"''
          ];
          tests.extension = postgresqlTestExtension {
            finalPackage = finalPackage.withPackages (ps: [ ps.base58 ]);
            sql = ''
              CREATE EXTENSION plpython3u;
              DO LANGUAGE plpython3u $$
                import base58
              $$;
            '';
          };
        };
        meta = {
          inherit (postgresql.meta)
            homepage
            license
            changelog
            maintainers
            platforms
            ;
          description = "PL/Python - Python Procedural Language";
        };
      };
    in
    finalPackage;
in
withPackages (_: [ ])