postgresql: provide plperl extension as package
This allows us to always build the extension, but still have the user explicitly enable it without causing rebuilds.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
The `nixLog` function, which logs unconditionally, was also re-introduced and modified to prefix messages with the function name of the caller.
|
||||
For more information, [see this PR](https://github.com/NixOS/nixpkgs/pull/370742).
|
||||
|
||||
- `postgresql`'s `pythonSupport` argument has been changed. It is now enabled by default, but to use PL/Python the extension needs to be added explicitly with `postgresql.withPackages`. If you were using `postgresql.override { pythonSupport = true; }` before, change it to `postgresql.withPackages (ps: [ ps.plpython3 ])`.
|
||||
- `postgresql`'s `pythonSupport` argument has been changed. It is now enabled by default, but to use PL/Python the extension needs to be added explicitly with `postgresql.withPackages`. If you were using `postgresql.override { pythonSupport = true; }` before, change it to `postgresql.withPackages (ps: [ ps.plpython3 ])`. The same applies to `perlSupport`/`plperl` respectively.
|
||||
|
||||
- The `rustPlatform.fetchCargoTarball` function is deprecated, because it relied on `cargo vendor` not changing its output format to keep fixed-output derivation hashes the same, which is a Nix invariant, and Cargo 1.84.0 changed `cargo vendor`'s output format.
|
||||
It should generally be replaced with `rustPlatform.fetchCargoVendor`, but `rustPlatform.importCargoLock` may also be appropriate in some circumstances.
|
||||
|
||||
@@ -9,6 +9,9 @@ in
|
||||
// {
|
||||
timescaledb-apache = super.callPackage ./ext/timescaledb.nix { enableUnfree = false; };
|
||||
}
|
||||
// lib.optionalAttrs (!self.perlSupport) {
|
||||
plperl = throw "PostgreSQL extension `plperl` is not available, because `postgresql` was built without Perl support. Override with `perlSupport = true` to enable the extension.";
|
||||
}
|
||||
// lib.optionalAttrs (!self.pythonSupport) {
|
||||
plpython3 = throw "PostgreSQL extension `plpython3` is not available, because `postgresql` was built without Python support. Override with `pythonSupport = true` to enable the extension.";
|
||||
}
|
||||
|
||||
45
pkgs/servers/sql/postgresql/ext/plperl.nix
Normal file
45
pkgs/servers/sql/postgresql/ext/plperl.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
buildEnv,
|
||||
perl,
|
||||
postgresql,
|
||||
postgresqlTestExtension,
|
||||
}:
|
||||
|
||||
let
|
||||
withPackages =
|
||||
f:
|
||||
let
|
||||
perl' = perl.withPackages f;
|
||||
finalPackage = buildEnv {
|
||||
name = "${postgresql.pname}-plperl-${postgresql.version}";
|
||||
paths = [ postgresql.plperl ];
|
||||
passthru = {
|
||||
inherit withPackages;
|
||||
wrapperArgs = [
|
||||
''--set PERL5LIB "${perl'}/${perl'.libPrefix}"''
|
||||
];
|
||||
tests.extension = postgresqlTestExtension {
|
||||
finalPackage = finalPackage.withPackages (ps: [ ps.boolean ]);
|
||||
sql = ''
|
||||
CREATE EXTENSION plperlu;
|
||||
DO LANGUAGE plperlu $$
|
||||
use boolean;
|
||||
$$;
|
||||
'';
|
||||
};
|
||||
};
|
||||
meta = {
|
||||
inherit (postgresql.meta)
|
||||
homepage
|
||||
license
|
||||
changelog
|
||||
maintainers
|
||||
platforms
|
||||
;
|
||||
description = "PL/Perl - Perl Procedural Language";
|
||||
};
|
||||
};
|
||||
in
|
||||
finalPackage;
|
||||
in
|
||||
withPackages (_: [ ])
|
||||
@@ -89,7 +89,13 @@ let
|
||||
linux-pam,
|
||||
|
||||
# PL/Perl
|
||||
perlSupport ? false,
|
||||
perlSupport ?
|
||||
lib.meta.availableOn stdenv.hostPlatform perl
|
||||
# Building with perl in pkgsStatic gives this error:
|
||||
# configure: error: cannot build PL/Perl because libperl is not a shared library
|
||||
&& !stdenv.hostPlatform.isStatic
|
||||
# configure tries to call the perl executable for the version
|
||||
&& stdenv.buildPlatform.canExecute stdenv.hostPlatform,
|
||||
perl,
|
||||
|
||||
# PL/Python
|
||||
@@ -153,13 +159,16 @@ let
|
||||
|
||||
hardeningEnable = lib.optionals (!stdenv'.cc.isClang) [ "pie" ];
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"dev"
|
||||
"doc"
|
||||
"lib"
|
||||
"man"
|
||||
] ++ lib.optionals pythonSupport [ "plpython3" ];
|
||||
outputs =
|
||||
[
|
||||
"out"
|
||||
"dev"
|
||||
"doc"
|
||||
"lib"
|
||||
"man"
|
||||
]
|
||||
++ lib.optionals perlSupport [ "plperl" ]
|
||||
++ lib.optionals pythonSupport [ "plpython3" ];
|
||||
outputChecks = {
|
||||
out = {
|
||||
disallowedReferences = [
|
||||
@@ -406,6 +415,10 @@ let
|
||||
substituteInPlace "$dev/lib/pgxs/src/Makefile.port" \
|
||||
--replace-fail '-bundle_loader $(bindir)/postgres' "-bundle_loader $out/bin/postgres"
|
||||
''
|
||||
+ lib.optionalString perlSupport ''
|
||||
moveToOutput "lib/*plperl*" "$plperl"
|
||||
moveToOutput "share/postgresql/extension/*plperl*" "$plperl"
|
||||
''
|
||||
+ lib.optionalString pythonSupport ''
|
||||
moveToOutput "lib/*plpython3*" "$plpython3"
|
||||
moveToOutput "share/postgresql/extension/*plpython3*" "$plpython3"
|
||||
@@ -449,7 +462,7 @@ let
|
||||
pkgs =
|
||||
let
|
||||
scope = {
|
||||
inherit jitSupport pythonSupport;
|
||||
inherit jitSupport pythonSupport perlSupport;
|
||||
inherit (llvmPackages) llvm;
|
||||
postgresql = this;
|
||||
stdenv = stdenv';
|
||||
|
||||
Reference in New Issue
Block a user