postgresql: provide pltcl 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:
parent
310ec25e98
commit
527713c1db
@ -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.
|
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).
|
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 ])`. The same applies to `perlSupport`/`plperl` respectively.
|
- `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` and `tclSupport`/`pltcl` 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.
|
- 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.
|
It should generally be replaced with `rustPlatform.fetchCargoVendor`, but `rustPlatform.importCargoLock` may also be appropriate in some circumstances.
|
||||||
|
|||||||
@ -15,6 +15,9 @@ in
|
|||||||
// lib.optionalAttrs (!self.pythonSupport) {
|
// 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.";
|
plpython3 = throw "PostgreSQL extension `plpython3` is not available, because `postgresql` was built without Python support. Override with `pythonSupport = true` to enable the extension.";
|
||||||
}
|
}
|
||||||
|
// lib.optionalAttrs (!self.tclSupport) {
|
||||||
|
pltcl = throw "PostgreSQL extension `pltcl` is not available, because `postgresql` was built without Tcl support. Override with `tclSupport = true` to enable the extension.";
|
||||||
|
}
|
||||||
// lib.optionalAttrs config.allowAliases {
|
// lib.optionalAttrs config.allowAliases {
|
||||||
pg_embedding = throw "PostgreSQL extension `pg_embedding` has been removed since the project has been abandoned. Upstream's recommendation is to use pgvector instead (https://neon.tech/docs/extensions/pg_embedding#migrate-from-pg_embedding-to-pgvector)";
|
pg_embedding = throw "PostgreSQL extension `pg_embedding` has been removed since the project has been abandoned. Upstream's recommendation is to use pgvector instead (https://neon.tech/docs/extensions/pg_embedding#migrate-from-pg_embedding-to-pgvector)";
|
||||||
}
|
}
|
||||||
|
|||||||
53
pkgs/servers/sql/postgresql/ext/pltcl.nix
Normal file
53
pkgs/servers/sql/postgresql/ext/pltcl.nix
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
buildEnv,
|
||||||
|
lib,
|
||||||
|
postgresql,
|
||||||
|
postgresqlTestExtension,
|
||||||
|
tcl,
|
||||||
|
tclPackages,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
withPackages =
|
||||||
|
f:
|
||||||
|
let
|
||||||
|
pkgs = f tclPackages;
|
||||||
|
paths = lib.concatMapStringsSep " " (pkg: "${pkg}/lib") pkgs;
|
||||||
|
finalPackage = buildEnv {
|
||||||
|
name = "${postgresql.pname}-pltcl-${postgresql.version}";
|
||||||
|
paths = [ postgresql.pltcl ];
|
||||||
|
passthru = {
|
||||||
|
inherit withPackages;
|
||||||
|
wrapperArgs = [
|
||||||
|
''--set TCLLIBPATH "${paths}"''
|
||||||
|
];
|
||||||
|
tests.extension = postgresqlTestExtension {
|
||||||
|
finalPackage = finalPackage.withPackages (ps: [
|
||||||
|
ps.mustache-tcl
|
||||||
|
ps.tcllib
|
||||||
|
]);
|
||||||
|
sql = ''
|
||||||
|
CREATE EXTENSION pltclu;
|
||||||
|
CREATE FUNCTION test() RETURNS VOID
|
||||||
|
LANGUAGE pltclu AS $$
|
||||||
|
package require mustache
|
||||||
|
$$;
|
||||||
|
SELECT test();
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
meta = {
|
||||||
|
inherit (postgresql.meta)
|
||||||
|
homepage
|
||||||
|
license
|
||||||
|
changelog
|
||||||
|
maintainers
|
||||||
|
platforms
|
||||||
|
;
|
||||||
|
description = "PL/Tcl - Tcl Procedural Language";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
finalPackage;
|
||||||
|
in
|
||||||
|
withPackages (_: [ ])
|
||||||
@ -109,7 +109,13 @@ let
|
|||||||
python3,
|
python3,
|
||||||
|
|
||||||
# PL/Tcl
|
# PL/Tcl
|
||||||
tclSupport ? false,
|
tclSupport ?
|
||||||
|
lib.meta.availableOn stdenv.hostPlatform tcl
|
||||||
|
# tcl is broken in pkgsStatic
|
||||||
|
&& !stdenv.hostPlatform.isStatic
|
||||||
|
# configure fails with:
|
||||||
|
# configure: error: file 'tclConfig.sh' is required for Tcl
|
||||||
|
&& stdenv.buildPlatform.canExecute stdenv.hostPlatform,
|
||||||
tcl,
|
tcl,
|
||||||
|
|
||||||
# SELinux
|
# SELinux
|
||||||
@ -168,7 +174,8 @@ let
|
|||||||
"man"
|
"man"
|
||||||
]
|
]
|
||||||
++ lib.optionals perlSupport [ "plperl" ]
|
++ lib.optionals perlSupport [ "plperl" ]
|
||||||
++ lib.optionals pythonSupport [ "plpython3" ];
|
++ lib.optionals pythonSupport [ "plpython3" ]
|
||||||
|
++ lib.optionals tclSupport [ "pltcl" ];
|
||||||
outputChecks = {
|
outputChecks = {
|
||||||
out = {
|
out = {
|
||||||
disallowedReferences = [
|
disallowedReferences = [
|
||||||
@ -422,6 +429,10 @@ let
|
|||||||
+ lib.optionalString pythonSupport ''
|
+ lib.optionalString pythonSupport ''
|
||||||
moveToOutput "lib/*plpython3*" "$plpython3"
|
moveToOutput "lib/*plpython3*" "$plpython3"
|
||||||
moveToOutput "share/postgresql/extension/*plpython3*" "$plpython3"
|
moveToOutput "share/postgresql/extension/*plpython3*" "$plpython3"
|
||||||
|
''
|
||||||
|
+ lib.optionalString tclSupport ''
|
||||||
|
moveToOutput "lib/*pltcl*" "$pltcl"
|
||||||
|
moveToOutput "share/postgresql/extension/*pltcl*" "$pltcl"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = lib.optionalString stdenv'.hostPlatform.isGnu ''
|
postFixup = lib.optionalString stdenv'.hostPlatform.isGnu ''
|
||||||
@ -462,7 +473,12 @@ let
|
|||||||
pkgs =
|
pkgs =
|
||||||
let
|
let
|
||||||
scope = {
|
scope = {
|
||||||
inherit jitSupport pythonSupport perlSupport;
|
inherit
|
||||||
|
jitSupport
|
||||||
|
pythonSupport
|
||||||
|
perlSupport
|
||||||
|
tclSupport
|
||||||
|
;
|
||||||
inherit (llvmPackages) llvm;
|
inherit (llvmPackages) llvm;
|
||||||
postgresql = this;
|
postgresql = this;
|
||||||
stdenv = stdenv';
|
stdenv = stdenv';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user