uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,70 @@
{ lib, stdenv, buildGoPackage, fetchurl
, cmake, xz, which, autoconf
, ncurses6, libedit, libunwind
, installShellFiles
, removeReferencesTo, go
}:
let
darwinDeps = [ libunwind libedit ];
linuxDeps = [ ncurses6 ];
buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps;
nativeBuildInputs = [ installShellFiles cmake xz which autoconf ];
in
buildGoPackage rec {
pname = "cockroach";
version = "20.1.8";
goPackagePath = "github.com/cockroachdb/cockroach";
src = fetchurl {
url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
sha256 = "0mm3hfr778c7djza8gr1clwa8wca4d3ldh9hlg80avw4x664y5zi";
};
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-Wno-error=deprecated-copy" "-Wno-error=redundant-move" "-Wno-error=pessimizing-move" ];
inherit nativeBuildInputs buildInputs;
buildPhase = ''
runHook preBuild
cd $NIX_BUILD_TOP/go/src/${goPackagePath}
patchShebangs .
make buildoss
cd src/${goPackagePath}
for asset in man autocomplete; do
./cockroachoss gen $asset
done
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -D cockroachoss $out/bin/cockroach
installShellCompletion cockroach.bash
mkdir -p $man/share/man
cp -r man $man/share/man
runHook postInstall
'';
outputs = [ "out" "man" ];
# fails with `GOFLAGS=-trimpath`
allowGoReference = true;
preFixup = ''
find $out -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${go} '{}' +
'';
meta = with lib; {
homepage = "https://www.cockroachlabs.com";
description = "A scalable, survivable, strongly-consistent SQL database";
license = licenses.bsl11;
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
maintainers = with maintainers; [ rushmorem thoughtpolice ];
};
}

View file

@ -0,0 +1,26 @@
{ fetchFromGitHub, lib, buildGoModule }:
buildGoModule rec {
pname = "dolt";
version = "0.39.2";
src = fetchFromGitHub {
owner = "dolthub";
repo = "dolt";
rev = "v${version}";
sha256 = "sha256-rCGjBb5aiDLPBKYX4jhHxtBDf3Xs1/p1DdsFmdfLNLM=";
};
modRoot = "./go";
subPackages = [ "cmd/dolt" "cmd/git-dolt" "cmd/git-dolt-smudge" ];
vendorSha256 = "sha256-yemt7hUcLXgC42B2q4+1MalGd3jCMHcVD/Bpq8B2x7M=";
doCheck = false;
meta = with lib; {
description = "Relational database with version control and CLI a-la Git";
homepage = "https://github.com/dolthub/dolt";
license = licenses.asl20;
maintainers = with maintainers; [ danbst ];
};
}

View file

@ -0,0 +1,6 @@
{ callPackage, ... } @ args:
callPackage ./. (args // {
version = "3.1.13";
sha256 = "0xb8fiissblxb319y5ifqqp86zblwis789ipb753pcb4zpnsaw82";
})

View file

@ -0,0 +1,6 @@
{ callPackage, ... } @ args:
callPackage ./. (args // {
version = "3.2.5";
sha256 = "0w0fimdiiqrrm012iflz8l4rnafryq7y0qqijzxn7nwzxhm9jsr9";
})

View file

@ -0,0 +1,68 @@
{ lib, stdenv, fetchurl, cmake
, curl, openssl, zlib
, libiconv
, version, sha256, ...
}:
with lib;
stdenv.mkDerivation {
pname = "mariadb-connector-c";
inherit version;
src = fetchurl {
url = "https://downloads.mariadb.com/Connectors/c/connector-c-${version}/mariadb-connector-c-${version}-src.tar.gz";
inherit sha256;
};
outputs = [ "out" "dev" ];
cmakeFlags = [
"-DMARIADB_UNIX_ADDR=/run/mysqld/mysqld.sock"
"-DWITH_CURL=ON"
"-DWITH_EXTERNAL_ZLIB=ON"
"-DWITH_MYSQLCOMPAT=ON"
];
postPatch = ''
substituteInPlace mariadb_config/mariadb_config.c.in \
--replace '-I%s/@INSTALL_INCLUDEDIR@' "-I$dev/include" \
--replace '-L%s/@INSTALL_LIBDIR@' "-L$out/lib/mariadb"
'' + lib.optionalString stdenv.hostPlatform.isStatic ''
# Disables all dynamic plugins
substituteInPlace cmake/plugins.cmake \
--replace 'if(''${CC_PLUGIN_DEFAULT} STREQUAL "DYNAMIC")' 'if(''${CC_PLUGIN_DEFAULT} STREQUAL "INVALID")'
# Force building static libraries
substituteInPlace libmariadb/CMakeLists.txt \
--replace 'libmariadb SHARED' 'libmariadb STATIC'
'';
# The cmake setup-hook uses $out/lib by default, this is not the case here.
preConfigure = optionalString stdenv.isDarwin ''
cmakeFlagsArray+=("-DCMAKE_INSTALL_NAME_DIR=$out/lib/mariadb")
'';
nativeBuildInputs = [ cmake ];
propagatedBuildInputs = [ curl openssl zlib ];
buildInputs = [ libiconv ];
postInstall = ''
moveToOutput bin/mariadb_config "$dev"
'';
postFixup = ''
ln -sv mariadb_config $dev/bin/mysql_config
ln -sv mariadb $out/lib/mysql
ln -sv mariadb $dev/include/mysql
ln -sv mariadb_version.h $dev/include/mariadb/mysql_version.h
ln -sv libmariadb.pc $dev/lib/pkgconfig/mysqlclient.pc
install -Dm644 include/ma_config.h $dev/include/mariadb/my_config.h
'';
meta = {
description = "Client library that can be used to connect to MySQL or MariaDB";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ globin ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,264 @@
{ lib, stdenv, fetchurl, nixosTests, buildPackages
# Native buildInputs components
, bison, boost, cmake, fixDarwinDylibNames, flex, makeWrapper, pkg-config
# Common components
, curl, libiconv, ncurses, openssl, pcre, pcre2
, libkrb5, libaio, liburing, systemd
, CoreServices, cctools, perl
, jemalloc, less, libedit
# Server components
, bzip2, lz4, lzo, snappy, xz, zlib, zstd
, cracklib, judy, libevent, libxml2
, linux-pam, numactl, pmdk
, fmt_8
, withStorageMroonga ? true, kytea, libsodium, msgpack, zeromq
, withStorageRocks ? true
}:
let
libExt = stdenv.hostPlatform.extensions.sharedLibrary;
mytopEnv = buildPackages.perl.withPackages (p: with p; [ DBDmysql DBI TermReadKey ]);
mariadbPackage = packageSettings: (server packageSettings) // {
client = client packageSettings; # MariaDB Client
server = server packageSettings; # MariaDB Server
};
commonOptions = packageSettings: rec { # attributes common to both builds
inherit (packageSettings) version;
src = fetchurl {
url = "https://downloads.mariadb.com/MariaDB/mariadb-${version}/source/mariadb-${version}.tar.gz";
inherit (packageSettings) sha256;
};
nativeBuildInputs = [ cmake pkg-config ]
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames
++ lib.optional (!stdenv.hostPlatform.isDarwin) makeWrapper;
buildInputs = [
curl libiconv ncurses openssl zlib
] ++ (packageSettings.extraBuildInputs or [])
++ lib.optionals stdenv.hostPlatform.isLinux ([ libkrb5 systemd ]
++ (if (lib.versionOlder version "10.6") then [ libaio ] else [ liburing ]))
++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices cctools perl libedit ]
++ lib.optional (!stdenv.hostPlatform.isDarwin) [ jemalloc ]
++ (if (lib.versionOlder version "10.5") then [ pcre ] else [ pcre2 ]);
prePatch = ''
sed -i 's,[^"]*/var/log,/var/log,g' storage/mroonga/vendor/groonga/CMakeLists.txt
'';
patches = [
./patch/cmake-includedir.patch
]
# Fixes a build issue as documented on
# https://jira.mariadb.org/browse/MDEV-26769?focusedCommentId=206073&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-206073
++ lib.optional (!stdenv.hostPlatform.isLinux && lib.versionAtLeast version "10.6") ./patch/macos-MDEV-26769-regression-fix.patch;
cmakeFlags = [
"-DBUILD_CONFIG=mysql_release"
"-DMANUFACTURER=nixos.org"
"-DDEFAULT_CHARSET=utf8mb4"
"-DDEFAULT_COLLATION=utf8mb4_unicode_ci"
"-DSECURITY_HARDENED=ON"
"-DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock"
"-DINSTALL_BINDIR=bin"
"-DINSTALL_DOCDIR=share/doc/mysql"
"-DINSTALL_DOCREADMEDIR=share/doc/mysql"
"-DINSTALL_INCLUDEDIR=include/mysql"
"-DINSTALL_LIBDIR=lib"
"-DINSTALL_PLUGINDIR=lib/mysql/plugin"
"-DINSTALL_INFODIR=share/mysql/docs"
"-DINSTALL_MANDIR=share/man"
"-DINSTALL_MYSQLSHAREDIR=share/mysql"
"-DINSTALL_SCRIPTDIR=bin"
"-DINSTALL_SUPPORTFILESDIR=share/doc/mysql"
"-DINSTALL_MYSQLTESTDIR=OFF"
"-DINSTALL_SQLBENCHDIR=OFF"
"-DINSTALL_PAMDIR=share/pam/lib/security"
"-DINSTALL_PAMDATADIR=share/pam/etc/security"
"-DWITH_ZLIB=system"
"-DWITH_SSL=system"
"-DWITH_PCRE=system"
"-DWITH_SAFEMALLOC=OFF"
"-DWITH_UNIT_TESTS=OFF"
"-DEMBEDDED_LIBRARY=OFF"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
# On Darwin without sandbox, CMake will find the system java and attempt to build with java support, but
# then it will fail during the actual build. Let's just disable the flag explicitly until someone decides
# to pass in java explicitly.
"-DCONNECT_WITH_JDBC=OFF"
"-DCURSES_LIBRARY=${ncurses.out}/lib/libncurses.dylib"
];
postInstall = ''
# Remove Development components. Need to use libmysqlclient.
rm "$out"/lib/mysql/plugin/daemon_example.ini
rm "$out"/lib/{libmariadbclient.a,libmysqlclient.a,libmysqlclient_r.a,libmysqlservices.a}
rm -f "$out"/bin/{mariadb-config,mariadb_config,mysql_config}
rm -r $out/include
rm -r $out/lib/pkgconfig
'';
# perlPackages.DBDmysql is broken on darwin
postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
wrapProgram $out/bin/mytop --set PATH ${lib.makeBinPath [ less ncurses ]}
'';
passthru.tests = let
testVersion = "mariadb_${builtins.replaceStrings ["."] [""] (lib.versions.majorMinor (packageSettings.version))}";
in {
mariadb-galera-rsync = nixosTests.mariadb-galera.${testVersion};
mysql = nixosTests.mysql.${testVersion};
mysql-autobackup = nixosTests.mysql-autobackup.${testVersion};
mysql-backup = nixosTests.mysql-backup.${testVersion};
mysql-replication = nixosTests.mysql-replication.${testVersion};
};
meta = with lib; {
description = "An enhanced, drop-in replacement for MySQL";
homepage = "https://mariadb.org/";
license = licenses.gpl2;
maintainers = with maintainers; [ thoughtpolice ajs124 das_j ];
platforms = platforms.all;
};
};
client = packageSettings: let
common = commonOptions packageSettings;
in stdenv.mkDerivation (common // {
pname = "mariadb-client";
outputs = [ "out" "man" ];
patches = common.patches ++ [
./patch/cmake-plugin-includedir.patch
];
cmakeFlags = common.cmakeFlags ++ [
"-DPLUGIN_AUTH_PAM=NO"
"-DWITHOUT_SERVER=ON"
"-DWITH_WSREP=OFF"
"-DINSTALL_MYSQLSHAREDIR=share/mysql-client"
];
postInstall = common.postInstall + ''
rm "$out"/bin/{mariadb-test,mysqltest}
libmysqlclient_path=$(readlink -f $out/lib/libmysqlclient${libExt})
rm "$out"/lib/{libmariadb${libExt},libmysqlclient${libExt},libmysqlclient_r${libExt}}
mv "$libmysqlclient_path" "$out"/lib/libmysqlclient${libExt}
ln -sv libmysqlclient${libExt} "$out"/lib/libmysqlclient_r${libExt}
'';
});
server = packageSettings: let
common = commonOptions packageSettings;
in stdenv.mkDerivation (common // {
pname = "mariadb-server";
outputs = [ "out" "man" ];
nativeBuildInputs = common.nativeBuildInputs ++ [ bison boost.dev flex ];
buildInputs = common.buildInputs ++ [
bzip2 lz4 lzo snappy xz zstd
cracklib judy libevent libxml2
] ++ lib.optional (stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32) numactl
++ lib.optionals stdenv.hostPlatform.isLinux [ linux-pam ]
++ lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) pmdk.dev
++ lib.optional (!stdenv.hostPlatform.isDarwin) mytopEnv
++ lib.optionals withStorageMroonga [ kytea libsodium msgpack zeromq ]
++ lib.optionals (lib.versionAtLeast common.version "10.7") [ fmt_8 ];
patches = common.patches;
postPatch = ''
substituteInPlace scripts/galera_new_cluster.sh \
--replace ":-mariadb" ":-mysql"
'';
cmakeFlags = common.cmakeFlags ++ [
"-DMYSQL_DATADIR=/var/lib/mysql"
"-DENABLED_LOCAL_INFILE=OFF"
"-DWITH_READLINE=ON"
"-DWITH_EXTRA_CHARSETS=all"
"-DWITH_EMBEDDED_SERVER=OFF"
"-DWITH_UNIT_TESTS=OFF"
"-DWITH_WSREP=ON"
"-DWITH_INNODB_DISALLOW_WRITES=ON"
"-DWITHOUT_EXAMPLE=1"
"-DWITHOUT_FEDERATED=1"
"-DWITHOUT_TOKUDB=1"
] ++ lib.optional (stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32) [
"-DWITH_NUMA=ON"
] ++ lib.optional (!withStorageMroonga) [
"-DWITHOUT_MROONGA=1"
] ++ lib.optional (!withStorageRocks) [
"-DWITHOUT_ROCKSDB=1"
] ++ lib.optional (!stdenv.hostPlatform.isDarwin && withStorageRocks) [
"-DWITH_ROCKSDB_JEMALLOC=ON"
] ++ lib.optional (!stdenv.hostPlatform.isDarwin) [
"-DWITH_JEMALLOC=yes"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DPLUGIN_AUTH_PAM=NO"
"-DPLUGIN_AUTH_PAM_V1=NO"
"-DWITHOUT_OQGRAPH=1"
"-DWITHOUT_PLUGIN_S3=1"
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
# revisit this if nixpkgs supports any architecture whose stack grows upwards
"-DSTACK_DIRECTION=-1"
"-DCMAKE_CROSSCOMPILING_EMULATOR=${stdenv.hostPlatform.emulator buildPackages}"
];
preConfigure = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
patchShebangs scripts/mytop.sh
'';
postInstall = common.postInstall + ''
rm -r "$out"/share/aclocal
chmod +x "$out"/bin/wsrep_sst_common
rm -f "$out"/bin/{mariadb-client-test,mariadb-test,mysql_client_test,mysqltest}
'' + lib.optionalString withStorageMroonga ''
mv "$out"/share/{groonga,groonga-normalizer-mysql} "$out"/share/doc/mysql
'' + lib.optionalString (!stdenv.hostPlatform.isDarwin && lib.versionAtLeast common.version "10.4") ''
mv "$out"/OFF/suite/plugins/pam/pam_mariadb_mtr.so "$out"/share/pam/lib/security
mv "$out"/OFF/suite/plugins/pam/mariadb_mtr "$out"/share/pam/etc/security
rm -r "$out"/OFF
'';
CXXFLAGS = lib.optionalString stdenv.hostPlatform.isi686 "-fpermissive";
});
in {
mariadb_104 = mariadbPackage {
# Supported until 2024-06-18
version = "10.4.25";
sha256 = "1y3ym8pb0pyra3dwy8sbzc4656c4y7g1savgyrsvf1mw2573r5pz";
};
mariadb_105 = mariadbPackage {
# Supported until 2025-06-24
version = "10.5.16";
sha256 = "19nj7ilk1aqs9zvvzhx4619pgfqjp7ac90ffr3fdaw4viljqfgn1";
};
mariadb_106 = mariadbPackage {
# Supported until 2026-07
version = "10.6.8";
sha256 = "0f6lkvv0dbq64y7zpks7nvhy1n08gad0i0dp0s2zpgfcb62liaap";
};
mariadb_107 = mariadbPackage {
# Supported until 2023-02
version = "10.7.4";
sha256 = "0ws17azsw3f26pkphjkyxmmi9qbv9gwidvz0ll6g482m6afrrpbk";
};
mariadb_108 = mariadbPackage {
# Supported until 2023-05
version = "10.8.3";
sha256 = "14h80lfb9b3rv3fd8nkljbqhx6dmwjnqkz6c3ynixb3na72sszl8";
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, buildEnv
, asio, boost, check, openssl, cmake
}:
stdenv.mkDerivation rec {
pname = "mariadb-galera";
version = "26.4.11";
src = fetchFromGitHub {
owner = "codership";
repo = "galera";
rev = "release_${version}";
sha256 = "sha256-zAS/YCUNSgkjehUXJpa+FyPC6zHnx3Nmlx0m7hbuZo0=";
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake ];
buildInputs = [ asio boost.dev check openssl ];
preConfigure = ''
# make sure bundled asio cannot be used, but leave behind license, because it gets installed
rm -r asio/{asio,asio.hpp}
'';
postInstall = ''
# for backwards compatibility
mkdir $out/lib/galera
ln -s $out/lib/libgalera_smm.so $out/lib/galera/libgalera_smm.so
'';
meta = with lib; {
description = "Galera 3 wsrep provider library";
homepage = "https://galeracluster.com/";
license = licenses.lgpl2Only;
maintainers = with maintainers; [ ajs124 izorkin ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,11 @@
--- a/include/CMakeLists.txt 2017-12-25 05:59:07.204144374 +0100
+++ b/include/CMakeLists.txt 2017-12-25 05:59:26.339552817 +0100
@@ -94,7 +94,7 @@
ENDIF()
MACRO(INSTALL_COMPAT_HEADER file footer)
- INSTALL(CODE "FILE(WRITE \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDEDIR}/${file}
+ INSTALL(CODE "FILE(WRITE ${INSTALL_INCLUDEDIR}/${file}
\"/* Do not edit this file directly, it was auto-generated by cmake */
#warning This file should not be included by clients, include only <mysql.h>

View file

@ -0,0 +1,16 @@
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 31291d26..fad52814 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -34,6 +34,11 @@ MACRO(MYSQL_ADD_PLUGIN)
"LINK_LIBRARIES;DEPENDENCIES"
${ARGN}
)
+
+ IF(WITHOUT_SERVER OR ARG_CLIENT)
+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ ENDIF()
+
IF(NOT WITHOUT_SERVER OR ARG_CLIENT)
# Add common include directories

View file

@ -0,0 +1,12 @@
diff -ru a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
--- a/storage/innobase/include/buf0types.h 2021-11-17 02:37:32.000000000 -0500
+++ b/storage/innobase/include/buf0types.h 2021-11-17 02:38:50.000000000 -0500
@@ -179,7 +179,7 @@
#include "sux_lock.h"
#ifdef SUX_LOCK_GENERIC
-class page_hash_latch : private rw_lock
+class page_hash_latch : public rw_lock
{
/** Wait for a shared lock */
void read_lock_wait();

View file

@ -0,0 +1,97 @@
{ stdenv
, lib
, fetchFromGitHub
, fetchzip
, rustPlatform
, bootstrap_cmds
, DiskArbitration
, Foundation
, cmake
, libiconv
, openssl
, perl
, pkg-config}:
let
fetchNpmPackage = {name, version, hash, js_prod_file, js_dev_file, ...} @ args:
let
package = fetchzip {
url = "https://registry.npmjs.org/${name}/-/${baseNameOf name}-${version}.tgz";
inherit hash;
};
static = "./src/materialized/src/http/static";
cssVendor = "./src/materialized/src/http/static/css/vendor";
jsProdVendor = "./src/materialized/src/http/static/js/vendor";
jsDevVendor = "./src/materialized/src/http/static-dev/js/vendor";
files = with args; [
{ src = js_prod_file; dst = "${jsProdVendor}/${name}.js"; }
{ src = js_dev_file; dst = "${jsDevVendor}/${name}.js"; }
] ++ lib.optional (args ? css_file) { src = css_file; dst = "${cssVendor}/${name}.css"; }
++ lib.optional (args ? extra_file) { src = extra_file.src; dst = "${static}/${extra_file.dst}"; };
in
lib.concatStringsSep "\n" (lib.forEach files ({src, dst}: ''
mkdir -p "${dirOf dst}"
cp "${package}/${src}" "${dst}"
''));
npmPackages = import ./npm_deps.nix;
in
rustPlatform.buildRustPackage rec {
pname = "materialize";
version = "0.17.0";
MZ_DEV_BUILD_SHA = "9f8cf75b461d288335cb6a7a73aaa670bab4a466";
src = fetchFromGitHub {
owner = "MaterializeInc";
repo = pname;
rev = "v${version}";
hash = "sha256-wKYU5S77VoOX7UA9/d21Puz9NYs/om08eNM69/m3Orc=";
};
cargoHash = "sha256-GTkn/fUprkpsDeQxtzdmS7Fub9QODO5/4nh9ERswOY0=";
nativeBuildInputs = [ cmake perl pkg-config ]
# Provides the mig command used by the krb5-src build script
++ lib.optional stdenv.isDarwin bootstrap_cmds;
# Needed to get openssl-sys to use pkg-config.
OPENSSL_NO_VENDOR = 1;
buildInputs = [ openssl ]
++ lib.optionals stdenv.isDarwin [ libiconv DiskArbitration Foundation ];
# Skip tests that use the network
checkFlags = [
"--exact"
"--skip test_client"
"--skip test_client_errors"
"--skip test_client_all_subjects"
"--skip test_client_subject_and_references"
"--skip test_no_block"
"--skip test_safe_mode"
"--skip test_tls"
];
postPatch = ''
${lib.concatStringsSep "\n" (map fetchNpmPackage npmPackages)}
substituteInPlace ./misc/dist/materialized.service \
--replace /usr/bin $out/bin \
--replace _Materialize root
'';
cargoBuildFlags = [ "--bin materialized" ];
postInstall = ''
install --mode=444 -D ./misc/dist/materialized.service $out/etc/systemd/system/materialized.service
'';
meta = with lib; {
homepage = "https://materialize.com";
description = "A streaming SQL materialized view engine for real-time applications";
license = licenses.bsl11;
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
maintainers = [ maintainers.petrosagg ];
};
}

View file

@ -0,0 +1,62 @@
# materialized doesn't use npm to pull in its few node dependencies but instead
# manually pulls the tar archives for each package and pulls out a couple of
# files.
#
# The list of modules can be found in this file
# https://github.com/MaterializeInc/materialize/blob/master/src/materialized/build/npm.rs
[
{
name = "@hpcc-js/wasm";
version = "0.3.14";
hash = "sha256-EsbuFk9qtlm9yWpG29RnqVAHrP0rk3xyibQLy8qgRT4=";
js_prod_file = "dist/index.min.js";
js_dev_file = "dist/index.js";
extra_file = {
src = "dist/graphvizlib.wasm";
dst = "js/vendor/@hpcc-js/graphvizlib.wasm";
};
}
{
name = "babel-standalone";
version = "6.26.0";
hash = "sha256-zdeTj4aOEzWvrnh90T80jL+RD8qg8PaeG0Ceua82Dz4=";
js_prod_file = "babel.min.js";
js_dev_file = "babel.js";
}
{
name = "d3";
version = "5.16.0";
hash = "sha256-aQQRhnJxV5/9C+cQslctP3v/AePGfbSw8L3chObJzK4=";
js_prod_file = "dist/d3.min.js";
js_dev_file = "dist/d3.js";
}
{
name = "d3-flame-graph";
version = "3.1.1";
hash = "sha256-Ls3MqALr6+/A+n8jqFw7frIB++6d1W3lAXKU0qFZ2ok=";
css_file = "dist/d3-flamegraph.css";
js_prod_file = "dist/d3-flamegraph.min.js";
js_dev_file = "dist/d3-flamegraph.js";
}
{
name = "pako";
version = "1.0.11";
hash = "sha256-St7nKpcYlJQl8qMmPkEHwmTufOHAeZK4lBZHo8VRXLA=";
js_prod_file = "dist/pako.min.js";
js_dev_file = "dist/pako.js";
}
{
name = "react";
version = "16.14.0";
hash = "sha256-X/8Bc4XvC8IqQWbW/PCRJQpmOBI/0AZT/hSFBf/uJU8=";
js_prod_file = "umd/react.production.min.js";
js_dev_file = "umd/react.development.js";
}
{
name = "react-dom";
version = "16.14.0";
hash = "sha256-2mYm9dwBFrWws6CB5bL6ghROTzX84RLM31hdnEbhG10=";
js_prod_file = "umd/react-dom.production.min.js";
js_dev_file = "umd/react-dom.development.js";
}
]

View file

@ -0,0 +1,34 @@
{ lib, stdenv, fetchurl, cmake, python3
, bison, openssl, readline, bzip2
}:
stdenv.mkDerivation rec {
pname = "monetdb";
version = "11.43.9";
src = fetchurl {
url = "https://dev.monetdb.org/downloads/sources/archive/MonetDB-${version}.tar.bz2";
sha256 = "sha256-DTpuL5caf4fmJMGq+1L3iyiSkLZYIUnejgJ/4LOk6kQ=";
};
postPatch = ''
substituteInPlace cmake/monetdb-packages.cmake --replace \
'get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION)' \
'set(LINUX_DISTRO "nixos")'
'';
postInstall = ''
rm $out/bin/monetdb_mtest.sh
'';
nativeBuildInputs = [ cmake python3 ];
buildInputs = [ bison openssl readline bzip2 ];
meta = with lib; {
description = "An open source database system";
homepage = "https://www.monetdb.org/";
license = licenses.mpl20;
platforms = platforms.unix;
maintainers = [ maintainers.StillerHarpo ];
};
}

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "mssql-jdbc";
version = "7.2.2";
src = fetchurl {
url = "https://github.com/Microsoft/mssql-jdbc/releases/download/v${version}/mssql-jdbc-${version}.jre8.jar";
sha256 = "09psxjy1v3khq8lcq6h9mbgyijsgawf0z2qryk1l91ypnwl8s3pg";
};
dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/java
cp $src $out/share/java/mssql-jdbc.jar
runHook postInstall
'';
meta = {
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,27 @@
{lib, stdenv, fetchurl, unzip}:
stdenv.mkDerivation rec {
pname = "jtds";
version = "1.3.1";
src = fetchurl {
url = "mirror://sourceforge/jtds/${version}/${pname}-${version}-dist.zip";
sha256 = "sha256-eV0P8QdjfuHXzYssH8yHhynuH0Clg7MAece2Up3S9M0";
};
sourceRoot = ".";
installPhase = ''
mkdir -p $out/share/java
cp jtds-*.jar $out/share/java/jtds-jdbc.jar
'';
nativeBuildInputs = [ unzip ];
meta = with lib; {
description = "Pure Java (type 4) JDBC 3.0 driver for Microsoft SQL Server";
homepage = "http://jtds.sourceforge.net/";
license = licenses.lgpl21;
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,90 @@
{ lib, stdenv, fetchurl, cmake, bison, pkg-config
, boost, libedit, libevent, lz4, ncurses, openssl, protobuf, readline, zlib, perl
, cctools, CoreServices, developer_cmds
, libtirpc, rpcsvc-proto, nixosTests
}:
# Note: zlib is not required; MySQL can use an internal zlib.
let
self = stdenv.mkDerivation rec {
pname = "mysql";
version = "5.7.37";
src = fetchurl {
url = "mirror://mysql/MySQL-5.7/${pname}-${version}.tar.gz";
sha256 = "sha256-qZqaqGNdJWbat2Sy3la+0XMDZdNg4guyf1Y5LOVOGL0=";
};
preConfigure = lib.optionalString stdenv.isDarwin ''
ln -s /bin/ps $TMPDIR/ps
export PATH=$PATH:$TMPDIR
'';
nativeBuildInputs = [ bison cmake pkg-config ]
++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
buildInputs = [ boost libedit libevent lz4 ncurses openssl protobuf readline zlib ]
++ lib.optionals stdenv.isDarwin [ perl cctools CoreServices developer_cmds ]
++ lib.optionals stdenv.isLinux [ libtirpc ];
outputs = [ "out" "static" ];
cmakeFlags = [
"-DCMAKE_SKIP_BUILD_RPATH=OFF" # To run libmysql/libmysql_api_test during build.
"-DWITH_SSL=yes"
"-DWITH_EMBEDDED_SERVER=yes"
"-DWITH_UNIT_TESTS=no"
"-DWITH_EDITLINE=system"
"-DWITH_LIBEVENT=system"
"-DWITH_LZ4=system"
"-DWITH_PROTOBUF=system"
"-DWITH_ZLIB=system"
"-DWITH_ARCHIVE_STORAGE_ENGINE=yes"
"-DWITH_BLACKHOLE_STORAGE_ENGINE=yes"
"-DWITH_FEDERATED_STORAGE_ENGINE=yes"
"-DHAVE_IPV6=yes"
"-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
"-DMYSQL_DATADIR=/var/lib/mysql"
"-DINSTALL_INFODIR=share/mysql/docs"
"-DINSTALL_MANDIR=share/man"
"-DINSTALL_PLUGINDIR=lib/mysql/plugin"
"-DINSTALL_SCRIPTDIR=bin"
"-DINSTALL_INCLUDEDIR=include/mysql"
"-DINSTALL_DOCREADMEDIR=share/mysql"
"-DINSTALL_SUPPORTFILESDIR=share/mysql"
"-DINSTALL_MYSQLSHAREDIR=share/mysql"
"-DINSTALL_MYSQLTESTDIR="
"-DINSTALL_DOCDIR=share/mysql/docs"
"-DINSTALL_SHAREDIR=share/mysql"
];
CXXFLAGS = "-fpermissive -std=c++11";
NIX_LDFLAGS = lib.optionalString stdenv.isLinux "-lgcc_s";
prePatch = ''
sed -i -e "s|/usr/bin/libtool|libtool|" cmake/merge_archives.cmake.in
'';
postInstall = ''
moveToOutput "lib/*.a" $static
ln -s libmysqlclient${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libmysqlclient_r${stdenv.hostPlatform.extensions.sharedLibrary}
'';
passthru = {
client = self;
connector-c = self;
server = self;
mysqlVersion = "5.7";
tests = nixosTests.mysql.mysql57;
};
meta = with lib; {
homepage = "https://www.mysql.com/";
description = "The world's most popular open source database";
platforms = platforms.unix;
license = with licenses; [
artistic1 bsd0 bsd2 bsd3 bsdOriginal
gpl2 lgpl2 lgpl21 mit publicDomain licenses.zlib
];
};
}; in self

View file

@ -0,0 +1,77 @@
{ lib, stdenv, fetchurl, bison, cmake, pkg-config
, boost, icu, libedit, libevent, lz4, ncurses, openssl, protobuf, re2, readline, zlib, zstd, libfido2
, numactl, perl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto, curl, DarwinTools, nixosTests
}:
let
self = stdenv.mkDerivation rec {
pname = "mysql";
version = "8.0.29";
src = fetchurl {
url = "https://dev.mysql.com/get/Downloads/MySQL-${self.mysqlVersion}/${pname}-${version}.tar.gz";
sha256 = "sha256-USFw+m94ppTW8Y0ZfpmdJxbuaNxUHXZE3ZIqNmNAcmY=";
};
nativeBuildInputs = [ bison cmake pkg-config ]
++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
postPatch = ''
substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
'';
buildInputs = [
boost curl icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
zstd libfido2
] ++ lib.optionals stdenv.isLinux [
numactl libtirpc
] ++ lib.optionals stdenv.isDarwin [
cctools CoreServices developer_cmds DarwinTools
];
outputs = [ "out" "static" ];
cmakeFlags = [
"-DCMAKE_SKIP_BUILD_RPATH=OFF" # To run libmysql/libmysql_api_test during build.
"-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
"-DWITH_ROUTER=OFF" # It may be packaged separately.
"-DWITH_SYSTEM_LIBS=ON"
"-DWITH_UNIT_TESTS=OFF"
"-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
"-DMYSQL_DATADIR=/var/lib/mysql"
"-DINSTALL_INFODIR=share/mysql/docs"
"-DINSTALL_MANDIR=share/man"
"-DINSTALL_PLUGINDIR=lib/mysql/plugin"
"-DINSTALL_INCLUDEDIR=include/mysql"
"-DINSTALL_DOCREADMEDIR=share/mysql"
"-DINSTALL_SUPPORTFILESDIR=share/mysql"
"-DINSTALL_MYSQLSHAREDIR=share/mysql"
"-DINSTALL_MYSQLTESTDIR="
"-DINSTALL_DOCDIR=share/mysql/docs"
"-DINSTALL_SHAREDIR=share/mysql"
];
postInstall = ''
moveToOutput "lib/*.a" $static
so=${stdenv.hostPlatform.extensions.sharedLibrary}
ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
'';
passthru = {
client = self;
connector-c = self;
server = self;
mysqlVersion = "8.0";
tests = nixosTests.mysql.mysql80;
};
meta = with lib; {
homepage = "https://www.mysql.com/";
description = "The world's most popular open source database";
license = licenses.gpl2;
maintainers = with maintainers; [ orivej ];
platforms = platforms.unix;
};
}; in self

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, ant, unzip }:
stdenv.mkDerivation rec {
pname = "mysql-connector-java";
version = "5.1.49";
src = fetchurl {
url = "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${version}.zip";
sha256 = "1bm4mm4xka4pq2rwxx3k8xlcpa1vjcglr3pf4ls2i4hamww047yk";
};
installPhase = ''
mkdir -p $out/share/java
cp mysql-connector-java-*-bin.jar $out/share/java/mysql-connector-java.jar
'';
nativeBuildInputs = [ unzip ];
buildInputs = [ ant ];
meta = with lib; {
description = "MySQL Connector/J";
homepage = "https://dev.mysql.com/doc/connector-j/8.0/en/";
maintainers = with maintainers; [ ];
platforms = platforms.unix;
license = licenses.gpl2;
};
}

View file

@ -0,0 +1,63 @@
{ lib
, pythonPackages
, fetchFromGitHub
}:
pythonPackages.buildPythonApplication rec {
pname = "patroni";
version = "2.1.3";
src = fetchFromGitHub {
owner = "zalando";
repo = pname;
rev = "v${version}";
sha256 = "sha256-cBkiBrty/6A3rIv9A1oh8GvPjwxhHwYEKuDIsNzHw1g=";
};
# cdiff renamed to ydiff; remove when patroni source reflects this.
postPatch = ''
for i in requirements.txt patroni/ctl.py tests/test_ctl.py; do
substituteInPlace $i --replace cdiff ydiff
done
'';
propagatedBuildInputs = with pythonPackages; [
boto
click
consul
dnspython
kazoo
kubernetes
prettytable
psutil
psycopg2
pysyncobj
python-dateutil
python-etcd
pyyaml
tzlocal
urllib3
ydiff
];
checkInputs = with pythonPackages; [
flake8
mock
pytestCheckHook
pytest-cov
requests
];
# Fix tests by preventing them from writing to /homeless-shelter.
preCheck = "export HOME=$(mktemp -d)";
pythonImportsCheck = [ "patroni" ];
meta = with lib; {
homepage = "https://patroni.readthedocs.io/en/latest/";
description = "A Template for PostgreSQL HA with ZooKeeper, etcd or Consul";
license = licenses.mit;
platforms = platforms.unix;
maintainers = teams.deshaw.members;
};
}

View file

@ -0,0 +1,60 @@
{ lib, stdenv, fetchurl, cmake, bison, ncurses, openssl, zlib, libaio, perl }:
stdenv.mkDerivation rec {
pname = "percona-server";
version = "5.6.49-89.0";
src = fetchurl {
url = "https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${version}/source/tarball/percona-server-${version}.tar.gz";
sha256 = "09qqk02iny7jvngyk6k2j0kk2sspc6gw8sm3i6nn97njbkihi697";
};
nativeBuildInputs = [ cmake bison perl ];
buildInputs = [ ncurses openssl zlib libaio ];
cmakeFlags = [
"-DFEATURE_SET=community"
"-DBUILD_CONFIG=mysql_release"
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
"-DWITH_SSL=yes"
"-DWITH_READLINE=no"
"-DWITH_EMBEDDED_SERVER=no"
"-DWITH_EDITLINE=bundled"
"-DWITH_ZLIB=yes"
"-DHAVE_IPV6=no"
"-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
"-DMYSQL_DATADIR=/var/lib/mysql"
"-DINSTALL_SYSCONFDIR=etc/mysql"
"-DINSTALL_INFODIR=share/mysql/docs"
"-DINSTALL_MANDIR=share/man"
"-DINSTALL_PLUGINDIR=lib/mysql/plugin"
"-DINSTALL_SCRIPTDIR=bin"
"-DINSTALL_INCLUDEDIR=include/mysql"
"-DINSTALL_DOCREADMEDIR=share/mysql"
"-DINSTALL_SUPPORTFILESDIR=share/mysql"
"-DINSTALL_MYSQLSHAREDIR=share/mysql"
"-DINSTALL_DOCDIR=share/mysql/docs"
"-DINSTALL_SHAREDIR=share/mysql"
];
NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
NIX_LDFLAGS = "-lgcc_s";
prePatch = ''
sed -i -e "s|/usr/bin/libtool|libtool|" cmake/libutils.cmake
'';
postInstall = ''
sed -i -e "s|basedir=\"\"|basedir=\"$out\"|" $out/bin/mysql_install_db
rm -r $out/mysql-test $out/sql-bench $out/data "$out"/lib/*.a
'';
passthru.mysqlVersion = "5.6";
meta = with lib; {
homepage = "https://www.percona.com";
description = "a free, fully compatible, enhanced, open source drop-in replacement for MySQL that provides superior performance, scalability and instrumentation";
platforms = platforms.linux;
license = licenses.gpl2;
maintainers = with maintainers; [ grahamc ];
};
}

View file

@ -0,0 +1,23 @@
{ lib, stdenv, fetchurl, openssl, libevent, c-ares, pkg-config }:
stdenv.mkDerivation rec {
pname = "pgbouncer";
version = "1.17.0";
src = fetchurl {
url = "https://pgbouncer.github.io/downloads/files/${version}/${pname}-${version}.tar.gz";
sha256 = "sha256-ZXMJt7xceoXL9wqaRBtTX3gkEjCB6rt7qG0ANJolbiM=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libevent openssl c-ares ];
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://pgbouncer.github.io";
description = "Lightweight connection pooler for PostgreSQL";
license = licenses.isc;
maintainers = with maintainers; [ _1000101 ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,34 @@
{ lib, stdenv, fetchurl, postgresql, openssl, pam ? null, libmemcached ? null }:
stdenv.mkDerivation rec {
pname = "pgpool-II";
version = "4.3.2";
src = fetchurl {
name = "${pname}-${version}.tar.gz";
url = "http://www.pgpool.net/download.php?f=${pname}-${version}.tar.gz";
sha256 = "02jg0c6k259i0r927dng9h0y58q965swshg2c9mzqhazcdiga5ap";
};
buildInputs = [ postgresql openssl pam libmemcached ];
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-openssl"
] ++ lib.optional (pam != null) "--with-pam"
++ lib.optional (libmemcached != null) "--with-memcached=${libmemcached}";
installFlags = [
"sysconfdir=\${out}/etc"
];
enableParallelBuilding = true;
meta = with lib; {
homepage = "http://pgpool.net/mediawiki/index.php";
description = "A middleware that works between postgresql servers and postgresql clients";
license = licenses.free;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,249 @@
let
generic =
# dependencies
{ stdenv, lib, fetchurl, makeWrapper
, glibc, zlib, readline, openssl, icu, lz4, systemd, libossp_uuid
, pkg-config, libxml2, tzdata
# This is important to obtain a version of `libpq` that does not depend on systemd.
, enableSystemd ? (lib.versionAtLeast version "9.6" && !stdenv.isDarwin)
, gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic, libkrb5
# for postgreql.pkgs
, this, self, newScope, buildEnv
# source specification
, version, sha256, psqlSchema,
# for tests
nixosTests, thisAttr
}:
let
atLeast = lib.versionAtLeast version;
icuEnabled = atLeast "10";
lz4Enabled = atLeast "14";
in stdenv.mkDerivation rec {
pname = "postgresql";
inherit version;
src = fetchurl {
url = "mirror://postgresql/source/v${version}/${pname}-${version}.tar.bz2";
inherit sha256;
};
hardeningEnable = lib.optionals (!stdenv.cc.isClang) [ "pie" ];
outputs = [ "out" "lib" "doc" "man" ];
setOutputFlags = false; # $out retains configureFlags :-/
buildInputs =
[ zlib readline openssl libxml2 ]
++ lib.optionals icuEnabled [ icu ]
++ lib.optionals lz4Enabled [ lz4 ]
++ lib.optionals enableSystemd [ systemd ]
++ lib.optionals gssSupport [ libkrb5 ]
++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ];
nativeBuildInputs = [ makeWrapper ] ++ lib.optionals icuEnabled [ pkg-config ];
enableParallelBuilding = !stdenv.isDarwin;
separateDebugInfo = true;
buildFlags = [ "world" ];
NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
# Otherwise it retains a reference to compiler and fails; see #44767. TODO: better.
preConfigure = "CC=${stdenv.cc.targetPrefix}cc";
configureFlags = [
"--with-openssl"
"--with-libxml"
"--sysconfdir=/etc"
"--libdir=$(lib)/lib"
"--with-system-tzdata=${tzdata}/share/zoneinfo"
"--enable-debug"
(lib.optionalString enableSystemd "--with-systemd")
(if stdenv.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid")
] ++ lib.optionals icuEnabled [ "--with-icu" ]
++ lib.optionals lz4Enabled [ "--with-lz4" ]
++ lib.optionals gssSupport [ "--with-gssapi" ]
++ lib.optionals stdenv.hostPlatform.isRiscV [ "--disable-spinlocks" ];
patches =
[ (if atLeast "9.4" then ./patches/disable-resolve_symlinks-94.patch else ./patches/disable-resolve_symlinks.patch)
(if atLeast "9.6" then ./patches/less-is-more-96.patch else ./patches/less-is-more.patch)
(if atLeast "9.6" then ./patches/hardcode-pgxs-path-96.patch else ./patches/hardcode-pgxs-path.patch)
./patches/specify_pkglibdir_at_runtime.patch
./patches/findstring.patch
]
++ lib.optional stdenv.isLinux (if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch);
installTargets = [ "install-world" ];
LC_ALL = "C";
postConfigure =
let path = if atLeast "9.6" then "src/common/config_info.c" else "src/bin/pg_config/pg_config.c"; in
''
# Hardcode the path to pgxs so pg_config returns the path in $out
substituteInPlace "${path}" --replace HARDCODED_PGXS_PATH $out/lib
'';
postInstall =
''
moveToOutput "lib/pgxs" "$out" # looks strange, but not deleting it
moveToOutput "lib/libpgcommon*.a" "$out"
moveToOutput "lib/libpgport*.a" "$out"
moveToOutput "lib/libecpg*" "$out"
# Prevent a retained dependency on gcc-wrapper.
substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv.cc}/bin/ld ld
if [ -z "''${dontDisableStatic:-}" ]; then
# Remove static libraries in case dynamic are available.
for i in $out/lib/*.a $lib/lib/*.a; do
name="$(basename "$i")"
ext="${stdenv.hostPlatform.extensions.sharedLibrary}"
if [ -e "$lib/lib/''${name%.a}$ext" ] || [ -e "''${i%.a}$ext" ]; then
rm "$i"
fi
done
fi
'';
postFixup = lib.optionalString (!stdenv.isDarwin && stdenv.hostPlatform.libc == "glibc")
''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
'';
doCheck = !stdenv.isDarwin;
# autodetection doesn't seem to able to find this, but it's there.
checkTarget = "check";
preCheck =
# On musl, comment skip the following tests, because they break due to
# ! ERROR: could not load library "/build/postgresql-11.5/tmp_install/nix/store/...-postgresql-11.5-lib/lib/libpqwalreceiver.so": Error loading shared library libpq.so.5: No such file or directory (needed by /build/postgresql-11.5/tmp_install/nix/store/...-postgresql-11.5-lib/lib/libpqwalreceiver.so)
# See also here:
# https://git.alpinelinux.org/aports/tree/main/postgresql/disable-broken-tests.patch?id=6d7d32c12e073a57a9e5946e55f4c1fbb68bd442
if stdenv.hostPlatform.isMusl then ''
substituteInPlace src/test/regress/parallel_schedule \
--replace "subscription" "" \
--replace "object_address" ""
'' else null;
doInstallCheck = false; # needs a running daemon?
disallowedReferences = [ stdenv.cc ];
passthru = {
inherit readline psqlSchema;
pkgs = let
scope = { postgresql = this; };
newSelf = self // scope;
newSuper = { callPackage = newScope (scope // this.pkgs); };
in import ./packages.nix newSelf newSuper;
withPackages = postgresqlWithPackages {
inherit makeWrapper buildEnv;
postgresql = this;
}
this.pkgs;
tests.postgresql = nixosTests.postgresql-wal-receiver.${thisAttr};
};
meta = with lib; {
homepage = "https://www.postgresql.org";
description = "A powerful, open source object-relational database system";
license = licenses.postgresql;
maintainers = with maintainers; [ thoughtpolice danbst globin marsam ivan ];
platforms = platforms.unix;
knownVulnerabilities = optional (!atLeast "9.4")
"PostgreSQL versions older than 9.4 are not maintained anymore!";
};
};
postgresqlWithPackages = { postgresql, makeWrapper, buildEnv }: pkgs: f: buildEnv {
name = "postgresql-and-plugins-${postgresql.version}";
paths = f pkgs ++ [
postgresql
postgresql.lib
postgresql.man # in case user installs this into environment
];
buildInputs = [ makeWrapper ];
# We include /bin to ensure the $out/bin directory is created, which is
# needed because we'll be removing the files from that directory in postBuild
# below. See #22653
pathsToLink = ["/" "/bin"];
# Note: the duplication of executables is about 4MB size.
# So a nicer solution was patching postgresql to allow setting the
# libdir explicitely.
postBuild = ''
mkdir -p $out/bin
rm $out/bin/{pg_config,postgres,pg_ctl}
cp --target-directory=$out/bin ${postgresql}/bin/{postgres,pg_config,pg_ctl}
wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
'';
passthru.version = postgresql.version;
passthru.psqlSchema = postgresql.psqlSchema;
};
in self: {
postgresql_10 = self.callPackage generic {
version = "10.21";
psqlSchema = "10.0"; # should be 10, but changing it is invasive
sha256 = "sha256-0yGYhW1Sqab11QZC74ZoesBYvW78pcntV754CElvRdE=";
this = self.postgresql_10;
thisAttr = "postgresql_10";
inherit self;
icu = self.icu67;
};
postgresql_11 = self.callPackage generic {
version = "11.16";
psqlSchema = "11.1"; # should be 11, but changing it is invasive
sha256 = "sha256-LdnhEfCllJ7nyswGXOoPshCSkpuuMQzgW/AbT/xRA6U=";
this = self.postgresql_11;
thisAttr = "postgresql_11";
inherit self;
};
postgresql_12 = self.callPackage generic {
version = "12.11";
psqlSchema = "12";
sha256 = "sha256-ECYkil/Svur0PkxyNqyBflbVi2gaM1hWRl37x1s+gwI=";
this = self.postgresql_12;
thisAttr = "postgresql_12";
inherit self;
};
postgresql_13 = self.callPackage generic {
version = "13.7";
psqlSchema = "13";
sha256 = "sha256-G5Bb9PPYNhSjk7PFH9NFkQ/SYeT1Ekpo2aH906KkY5k=";
this = self.postgresql_13;
thisAttr = "postgresql_13";
inherit self;
};
postgresql_14 = self.callPackage generic {
version = "14.3";
psqlSchema = "14";
sha256 = "sha256-J5BXNov1mpGcBa2o+VxeBKu0PnS5oqacPUaiDgeprzg=";
this = self.postgresql_14;
thisAttr = "postgresql_14";
inherit self;
};
}

View file

@ -0,0 +1,65 @@
{ lib, stdenv, fetchFromGitHub, bison, flex, postgresql }:
stdenv.mkDerivation rec {
pname = "age";
version = "0.6.0";
src = fetchFromGitHub {
owner = "apache";
repo = "incubator-age";
rev = "v${version}";
sha256 = "1cl6p9qz2yhgm603ljlyjdn0msk3hzga1frjqsmqmpp3nw4dbkka";
};
buildInputs = [ postgresql ];
makeFlags = [
"BISON=${bison}/bin/bison"
"FLEX=${flex}/bin/flex"
];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
passthru.tests = stdenv.mkDerivation {
inherit version src;
pname = "age-regression";
dontConfigure = true;
buildPhase = let
postgresqlAge = postgresql.withPackages (ps: [ ps.age ]);
in ''
# The regression tests need to be run in the order specified in the Makefile.
echo -e "include Makefile\nfiles:\n\t@echo \$(REGRESS)" > Makefile.regress
REGRESS_TESTS=$(make -f Makefile.regress files)
${postgresql}/lib/pgxs/src/test/regress/pg_regress \
--inputdir=./ \
--bindir='${postgresqlAge}/bin' \
--encoding=UTF-8 \
--load-extension=age \
--inputdir=./regress --outputdir=./regress --temp-instance=./regress/instance \
--port=61958 --dbname=contrib_regression \
$REGRESS_TESTS
'';
installPhase = ''
touch $out
'';
};
meta = with lib; {
broken = true;
description = "A graph database extension for PostgreSQL";
homepage = "https://age.apache.org/";
changelog = "https://github.com/apache/incubator-age/releases/tag/v${version}";
maintainers = with maintainers; [ ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchFromGitHub, postgresql, protobufc }:
stdenv.mkDerivation rec {
pname = "cstore_fdw";
version = "unstable-2022-03-08";
nativeBuildInputs = [ protobufc ];
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "cstore_fdw";
rev = "90e22b62fbee6852529104fdd463f532cf7a3311";
sha256 = "sha256-02wcCqs8A5ZOZX080fgcNJTQrYQctnlwnA8+YPaRTZc=";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
broken = versionAtLeast postgresql.version "14";
description = "Columnar storage for PostgreSQL";
homepage = "https://github.com/citusdata/cstore_fdw";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "jsonb_deep_sum";
version = "unstable-2021-12-24";
src = fetchFromGitHub {
owner = "furstenheim";
repo = "jsonb_deep_sum";
rev = "d9c69aa6b7da860e5522a9426467e67cb787980c";
sha256 = "sha256-W1wNILAwTAjFPezq+grdRMA59KEnMZDz69n9xQUqdc0=";
};
buildInputs = [ postgresql ];
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "PostgreSQL extension to easily add jsonb numeric";
homepage = "https://github.com/furstenheim/jsonb_deep_sum";
maintainers = with maintainers; [ _1000101 ];
platforms = postgresql.meta.platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "periods";
version = "1.2";
src = fetchFromGitHub {
owner = "xocolatl";
repo = pname;
rev = "v${version}";
sha256 = "13aix61qzlb7cs042dz4x0z4sc2xayg4nzi2cks46zibxm5i4gzm";
};
buildInputs = [ postgresql ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
meta = with lib; {
description = "PostgreSQL extension implementing SQL standard functionality for PERIODs and SYSTEM VERSIONING";
homepage = "https://github.com/xocolatl/periods";
maintainers = with maintainers; [ ivan ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
broken = versionOlder postgresql.version "9.5";
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline, libkrb5 }:
stdenv.mkDerivation rec {
pname = "pg_auto_failover";
version = "1.6.4";
src = fetchFromGitHub {
owner = "citusdata";
repo = pname;
rev = "v${version}";
sha256 = "sha256-MzMKVS86ymfRwZqTzJsdophRrIIPDp50Wpt7QkGA6Nc=";
};
buildInputs = [ postgresql openssl zlib readline libkrb5 ];
installPhase = ''
install -D -t $out/bin src/bin/pg_autoctl/pg_autoctl
install -D -t $out/lib src/monitor/pgautofailover.so
install -D -t $out/share/postgresql/extension src/monitor/*.sql
install -D -t $out/share/postgresql/extension src/monitor/pgautofailover.control
'';
meta = with lib; {
description = "PostgreSQL extension and service for automated failover and high-availability";
homepage = "https://github.com/citusdata/pg_auto_failover";
changelog = "https://github.com/citusdata/pg_auto_failover/raw/v${version}/CHANGELOG.md";
maintainers = [ maintainers.marsam ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
broken = versionOlder postgresql.version "10";
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_bigm";
version = "1.2-20200228";
src = fetchurl {
url = "mirror://osdn/pgbigm/72448/${pname}-${version}.tar.gz";
sha256 = "1hxn90prldwriqmqlf33ypgbxw5v54gkzx1305yzghryzfg7rhbl";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
mkdir -p $out/bin # For buildEnv to setup proper symlinks. See #22653
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Text similarity measurement and index searching based on bigrams";
homepage = "https://pgbigm.osdn.jp/";
maintainers = [ maintainers.marsam ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_cron";
version = "1.4.1";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = pname;
rev = "v${version}";
sha256 = "1fknr7z1m24dpp4hm5s6y5phdns7yvvj88cl481wjhw8bigz6kns";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Run Cron jobs through PostgreSQL";
homepage = "https://github.com/citusdata/pg_cron";
changelog = "https://github.com/citusdata/pg_cron/raw/v${version}/CHANGELOG.md";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitLab, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_ed25519";
version = "0.2";
src = fetchFromGitLab {
owner = "dwagin";
repo = "pg_ed25519";
rev = version;
sha256 = "16w3qx3wj81bzfhydl2pjhn8b1jak6h7ja9wq1kc626g0siggqi0";
};
buildInputs = [ postgresql ];
installPhase = ''
mkdir -p $out/bin # For buildEnv to setup proper symlinks. See #22653
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "PostgreSQL extension for signing and verifying ed25519 signatures";
homepage = "https://gitlab.com/dwagin/pg_ed25519";
maintainers = [ maintainers.renzo ];
platforms = postgresql.meta.platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_hll";
version = "2.16";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "postgresql-hll";
rev = "refs/tags/v${version}";
sha256 = "0icns4m3dkm20fs6gznciwsb8ba8gcc316igz6j7qwjdnyg2ppbf";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "HyperLogLog for PostgreSQL";
homepage = "https://github.com/citusdata/postgresql-hll";
changelog = "https://github.com/citusdata/postgresql-hll/raw/v${version}/CHANGELOG.md";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_partman";
version = "4.6.0";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "pgpartman";
repo = pname;
rev = "refs/tags/v${version}";
sha256 = "sha256-DpK3D7PEZ1sO9bYvwwT9L8jtDmUGMbHtx2s9juzL6RQ=";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp src/*.so $out/lib
cp updates/* $out/share/postgresql/extension
cp -r sql/* $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Partition management extension for PostgreSQL";
homepage = "https://github.com/pgpartman/pg_partman";
maintainers = with maintainers; [ ggpeti ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,39 @@
{ stdenv
, fetchFromGitHub
, lib
, postgresql
}:
stdenv.mkDerivation rec {
pname = "pg_rational";
version = "0.0.2";
src = fetchFromGitHub {
owner = "begriffs";
repo = "pg_rational";
rev = "v${version}";
sha256 = "sha256-Sp5wuX2nP3KGyWw7MFa11rI1CPIKIWBt8nvBSsASIEw=";
};
buildInputs = [ postgresql ];
installPhase = ''
runHook preInstall
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
runHook postInstall
'';
meta = with lib; {
description = "Precise fractional arithmetic for PostgreSQL";
homepage = "https://github.com/begriffs/pg_rational";
maintainers = with maintainers; [ netcrns ];
platforms = postgresql.meta.platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,35 @@
{ lib, stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline }:
stdenv.mkDerivation rec {
pname = "pg_repack";
version = "1.4.7";
buildInputs = [ postgresql openssl zlib readline ];
src = fetchFromGitHub {
owner = "reorg";
repo = "pg_repack";
rev = "refs/tags/ver_${version}";
sha256 = "12j8crgljvkm9dz790xcsr8l7sv8ydvb2imrb0jh1jvj0r9yg1v5";
};
installPhase = ''
install -D bin/pg_repack -t $out/bin/
install -D lib/pg_repack.so -t $out/lib/
install -D lib/{pg_repack--${version}.sql,pg_repack.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "Reorganize tables in PostgreSQL databases with minimal locks";
longDescription = ''
pg_repack is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore
the physical order of clustered indexes. Unlike CLUSTER and VACUUM FULL it works online, without holding an
exclusive lock on the processed tables during processing. pg_repack is efficient to boot,
with performance comparable to using CLUSTER directly.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ danbst ];
inherit (postgresql.meta) platforms;
inherit (src.meta) homepage;
};
}

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg-safeupdate";
version = "1.4";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "eradman";
repo = pname;
rev = version;
sha256 = "sha256-1cyvVEC9MQGMr7Tg6EUbsVBrMc8ahdFS3+CmDkmAq4Y=";
};
installPhase = ''
mkdir -p $out/bin # for buildEnv, see https://github.com/NixOS/nixpkgs/issues/22653
install -D safeupdate.so -t $out/lib
'';
meta = with lib; {
description = "A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE";
homepage = "https://github.com/eradman/pg-safeupdate";
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ stdenv, lib, fetchFromGitHub, gcc, postgresql }:
stdenv.mkDerivation {
pname = "pg_similarity";
version = "1.0";
src = fetchFromGitHub {
owner = "eulerto";
repo = "pg_similarity";
rev = "be1a8b08c8716e59b89982557da9ea68cdf868c5";
sha256 = "1z4v4r2yccdr8kz3935fnk1bc5vj0qj0apscldyap4wxlyi89xim";
};
buildInputs = [ postgresql gcc ];
buildPhase = "USE_PGXS=1 make";
installPhase = ''
install -D pg_similarity.so -t $out/lib/
install -D ./{pg_similarity--unpackaged--1.0.sql,pg_similarity--1.0.sql,pg_similarity.control} -t $out/share/postgresql/extension
'';
meta = {
description = "An extension to support similarity queries on PostgreSQL";
longDescription = ''
pg_similarity is an extension to support similarity queries on PostgreSQL. The implementation
is tightly integrated in the RDBMS in the sense that it defines operators so instead of the traditional
operators (= and <>) you can use ~~~ and ~!~ (any of these operators represents a similarity function).
'';
platforms = postgresql.meta.platforms;
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ danbst ];
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_topn";
version = "2.4.0";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "postgresql-topn";
rev = "refs/tags/v${version}";
sha256 = "1appxriw7h29kyhv3h6b338g5m2nz70q3mxasy4mjimqhbz1zyqs";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Efficient querying of 'top values' for PostgreSQL";
homepage = "https://github.com/citusdata/postgresql-topn";
changelog = "https://github.com/citusdata/postgresql-topn/raw/v${version}/CHANGELOG.md";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.agpl3Only;
};
}

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation {
pname = "pgjwt";
version = "unstable-2017-04-24";
src = fetchFromGitHub {
owner = "michelp";
repo = "pgjwt";
rev = "546a2911027b716586e241be7fd4c6f1785237cd";
sha256 = "1riz0xvwb6y02j0fljbr9hcbqb2jqs4njlivmavy9ysbcrrv1vrf";
};
dontBuild = true;
installPhase = ''
mkdir -p $out/share/postgresql/extension
cp pg*sql *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "PostgreSQL implementation of JSON Web Tokens";
longDescription = ''
sign() and verify() functions to create and verify JSON Web Tokens.
'';
license = licenses.mit;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [spinus];
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv, fetchurl, pkg-config, postgresql, msgpack, groonga }:
stdenv.mkDerivation rec {
pname = "pgroonga";
version = "2.3.6";
src = fetchurl {
url = "https://packages.groonga.org/source/${pname}/${pname}-${version}.tar.gz";
sha256 = "sha256-/GimaiFuMEuw4u9if3Z//1KPT78rvaJ+jNjbG3ugkLA=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ postgresql msgpack groonga ];
makeFlags = [ "HAVE_MSGPACK=1" ];
installPhase = ''
install -D pgroonga.so -t $out/lib/
install -D pgroonga.control -t $out/share/postgresql/extension
install -D data/pgroonga-*.sql -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A PostgreSQL extension to use Groonga as the index";
longDescription = ''
PGroonga is a PostgreSQL extension to use Groonga as the index.
PostgreSQL supports full text search against languages that use only alphabet and digit.
It means that PostgreSQL doesn't support full text search against Japanese, Chinese and so on.
You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL.
'';
homepage = "https://pgroonga.github.io/";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ DerTim1 ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql, perl, cmake, boost }:
stdenv.mkDerivation rec {
pname = "pgrouting";
version = "3.3.0";
nativeBuildInputs = [ cmake perl ];
buildInputs = [ postgresql boost ];
src = fetchFromGitHub {
owner = "pgRouting";
repo = pname;
rev = "v${version}";
sha256 = "sha256-GWufuOsAYLIOy5MXYVNFWVeVdLntd5ZeUnSdEahlkak=";
};
installPhase = ''
install -D lib/*.so -t $out/lib
install -D sql/pgrouting--${version}.sql -t $out/share/postgresql/extension
install -D sql/common/pgrouting.control -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A PostgreSQL/PostGIS extension that provides geospatial routing functionality";
homepage = "https://pgrouting.org/";
changelog = "https://github.com/pgRouting/pgrouting/releases/tag/v${version}";
maintainers = [ maintainers.steve-chavez ];
platforms = postgresql.meta.platforms;
license = licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchFromGitHub, postgresql, perl, perlPackages, which }:
stdenv.mkDerivation rec {
pname = "pgtap";
version = "1.2.0";
src = fetchFromGitHub {
owner = "theory";
repo = "pgtap";
rev = "v${version}";
sha256 = "sha256-lb0PRffwo6J5a6Hqw1ggvn0cW7gPZ02OEcLPi9ineI8=";
};
nativeBuildInputs = [ postgresql perl perlPackages.TAPParserSourceHandlerpgTAP which ];
installPhase = ''
install -D {sql/pgtap--${version}.sql,pgtap.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A unit testing framework for PostgreSQL";
longDescription = ''
pgTAP is a unit testing framework for PostgreSQL written in PL/pgSQL and PL/SQL.
It includes a comprehensive collection of TAP-emitting assertion functions,
as well as the ability to integrate with other TAP-emitting test frameworks.
It can also be used in the xUnit testing style.
'';
maintainers = with maintainers; [ willibutz ];
homepage = "https://pgtap.org";
inherit (postgresql.meta) platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pgvector";
version = "0.2.6";
src = fetchFromGitHub {
owner = "ankane";
repo = pname;
rev = "v${version}";
sha256 = "sha256-NmUI4pXwf6PHuLbkFy/hoA67j++A2Ju7zG/4og9U+qk=";
};
buildInputs = [ postgresql ];
installPhase = ''
install -D -t $out/lib vector.so
install -D -t $out/share/postgresql/extension sql/vector-*.sql
install -D -t $out/share/postgresql/extension vector.control
'';
meta = with lib; {
description = "Open-source vector similarity search for PostgreSQL";
homepage = "https://github.com/ankane/pgvector";
changelog = "https://github.com/ankane/pgvector/raw/v${version}/CHANGELOG.md";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = [ maintainers.marsam ];
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, postgresql, zeromq, openssl, libsodium, libkrb5 }:
stdenv.mkDerivation rec {
pname = "pipelinedb";
version = "1.0.0-13";
src = fetchFromGitHub {
owner = "pipelinedb";
repo = pname;
rev = version;
sha256 = "1mnqpvx6g1r2n4kjrrx01vbdx7kvndfsbmm7zbzizjnjlyixz75f";
};
buildInputs = [ postgresql openssl zeromq libsodium libkrb5 ];
makeFlags = [ "USE_PGXS=1" ];
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lsodium";
preConfigure = ''
substituteInPlace Makefile \
--replace "/usr/lib/libzmq.a" "${zeromq}/lib/libzmq.a"
'';
installPhase = ''
mkdir -p $out/bin
install -D -t $out/lib/ pipelinedb.so
install -D -t $out/share/postgresql/extension {pipelinedb-*.sql,pipelinedb.control}
'';
meta = with lib; {
description = "High-performance time-series aggregation for PostgreSQL";
homepage = "https://www.pipelinedb.com/";
license = licenses.asl20;
platforms = postgresql.meta.platforms;
maintainers = [ maintainers.marsam ];
broken = versions.major postgresql.version != "11";
};
}

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "plpgsql_check";
version = "2.1.5";
src = fetchFromGitHub {
owner = "okbob";
repo = pname;
rev = "v${version}";
sha256 = "sha256-DYdZuHraecQZ33xHX6ugiUJVfFVAayD2spIQt2Qqa5U=";
};
buildInputs = [ postgresql ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
meta = with lib; {
description = "Linter tool for language PL/pgSQL";
homepage = "https://github.com/okbob/plpgsql_check";
platforms = postgresql.meta.platforms;
license = licenses.mit;
maintainers = [ maintainers.marsam ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, R, postgresql }:
stdenv.mkDerivation rec {
pname = "plr";
version = "8.4.5";
src = fetchFromGitHub {
owner = "postgres-plr";
repo = "plr";
rev = "REL${builtins.replaceStrings ["."] ["_"] version}";
sha256 = "sha256-G/V3I1JI6dWto/hK6lfOTBYEvbmkovvnvk2TwSQq4no=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ R postgresql ];
preBuild = ''
export USE_PGXS=1
'';
installPhase = ''
install -D plr.so -t $out/lib/
install -D {plr--*.sql,plr.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "PL/R - R Procedural Language for PostgreSQL";
homepage = "https://github.com/postgres-plr/plr";
maintainers = with maintainers; [ qoelet ];
platforms = postgresql.meta.platforms;
license = licenses.gpl2Only;
};
}

View file

@ -0,0 +1,87 @@
{ lib, stdenv, fetchFromGitHub, v8, perl, postgresql
# For test
, runCommand, coreutils, gnugrep }:
let self = stdenv.mkDerivation rec {
pname = "plv8";
version = "3.0.0";
nativeBuildInputs = [ perl ];
buildInputs = [ v8 postgresql ];
src = fetchFromGitHub {
owner = "plv8";
repo = "plv8";
rev = "v${version}";
sha256 = "KJz8wnGcTXnVn6umpP+UquuJTtQrkBTJ33rB/JIH4kU=";
};
makefile = "Makefile.shared";
buildFlags = [ "all" ];
makeFlags = [
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
"V8_OUTDIR=${v8}/lib"
];
installFlags = [
# PGXS only supports installing to postgresql prefix so we need to redirect this
"DESTDIR=${placeholder "out"}"
];
preConfigure = ''
# We build V8 as a monolith, so this is unnecessary.
substituteInPlace Makefile.shared --replace "-lv8_libplatform" ""
patchShebangs ./generate_upgrade.sh
substituteInPlace generate_upgrade.sh \
--replace " 2.3.10)" " 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.15)"
'';
postInstall = ''
# Move the redirected to proper directory.
# There appear to be no references to the install directories
# so changing them does not cause issues.
mv "$out/nix/store"/*/* "$out"
rmdir "$out/nix/store"/* "$out/nix/store" "$out/nix"
'';
NIX_CFLAGS_COMPILE = [
# V8 depends on C++14.
"-std=c++14"
# Without this, PostgreSQL will crash at runtime.
# The flags are only included in Makefile, not Makefile.shared.
# https://github.com/plv8/plv8/pull/469
"-DJSONB_DIRECT_CONVERSION" "-DV8_COMPRESS_POINTERS=1" "-DV8_31BIT_SMIS_ON_64BIT_ARCH=1"
];
passthru.tests.smoke = runCommand "${pname}-test" {} ''
export PATH=${lib.makeBinPath [ (postgresql.withPackages (_: [self])) coreutils gnugrep ]}
db="$PWD/testdb"
initdb "$db"
postgres -k "$db" -D "$db" &
pid="$!"
for i in $(seq 1 100); do
if psql -h "$db" -d postgres -c "" 2>/dev/null; then
break
elif ! kill -0 "$pid"; then
exit 1
else
sleep 0.1
fi
done
psql -h "$db" -d postgres -c 'CREATE EXTENSION plv8; DO $$ plv8.elog(NOTICE, plv8.version); $$ LANGUAGE plv8;' 2> "$out"
grep -q "${version}" "$out"
kill -0 "$pid"
'';
meta = with lib; {
description = "V8 Engine Javascript Procedural Language add-on for PostgreSQL";
homepage = "https://plv8.github.io/";
maintainers = with maintainers; [ volth marsam ];
platforms = [ "x86_64-linux" ];
license = licenses.postgresql;
};
}; in self

View file

@ -0,0 +1,79 @@
{ fetchurl
, lib, stdenv
, perl
, libxml2
, postgresql
, geos
, proj
, gdal
, json_c
, pkg-config
, file
, protobufc
, libiconv
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "postgis";
version = "3.2.1";
outputs = [ "out" "doc" ];
src = fetchurl {
url = "https://download.osgeo.org/postgis/source/postgis-${version}.tar.gz";
sha256 = "sha256-+6to3ebKOTSyS6CMirDP8llPV/k96rQaFcgq4btpiT4=";
};
buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ]
++ lib.optional stdenv.isDarwin libiconv;
nativeBuildInputs = [ perl pkg-config ];
dontDisableStatic = true;
# postgis config directory assumes /include /lib from the same root for json-c library
NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
preConfigure = ''
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
configureFlags="--datadir=$out/share/postgresql --datarootdir=$out/share/postgresql --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
makeFlags="PERL=${perl}/bin/perl datadir=$out/share/postgresql pkglibdir=$out/lib bindir=$out/bin"
'';
postConfigure = ''
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/loader/Makefile";
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/scripts/python/Makefile";
mkdir -p $out/bin
# postgis' build system assumes it is being installed to the same place as postgresql, and looks
# for the postgres binary relative to $PREFIX. We gently support this system using an illusion.
ln -s ${postgresql}/bin/postgres $out/bin/postgres
'';
# create aliases for all commands adding version information
postInstall = ''
# Teardown the illusory postgres used for building; see postConfigure.
rm $out/bin/postgres
for prog in $out/bin/*; do # */
ln -s $prog $prog-${version}
done
mkdir -p $doc/share/doc/postgis
mv doc/* $doc/share/doc/postgis/
'';
passthru.tests.postgis = nixosTests.postgis;
meta = with lib; {
description = "Geographic Objects for PostgreSQL";
homepage = "https://postgis.net/";
changelog = "https://git.osgeo.org/gitea/postgis/postgis/raw/tag/${version}/NEWS";
license = licenses.gpl2;
maintainers = [ maintainers.marcweber ];
inherit (postgresql.meta) platforms;
};
}

View file

@ -0,0 +1,40 @@
{ lib, stdenv, fetchFromGitHub
, postgresql
, openssl
, zlib
, readline
, flex
}:
stdenv.mkDerivation rec {
pname = "repmgr";
version = "5.3.1";
src = fetchFromGitHub {
owner = "2ndQuadrant";
repo = "repmgr";
rev = "v${version}";
sha256 = "sha256-fHoXbFOF3xj/eNHgQIghF15vbDObnuwl2DAH+zRVGZQ=";
};
nativeBuildInputs = [ flex ];
buildInputs = [ postgresql openssl zlib readline ];
installPhase = ''
mkdir -p $out/{bin,lib,share/postgresql/extension}
cp repmgr{,d} $out/bin
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
homepage = "https://repmgr.org/";
description = "Replication manager for PostgreSQL cluster";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ zimbatm ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "rum";
version = "1.3.11";
src = fetchFromGitHub {
owner = "postgrespro";
repo = "rum";
rev = version;
sha256 = "sha256-OuVyZ30loPycQkDwlL0289H/4RRPneibqgibgzqhWo4=";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.control
install -D -t $out/share/postgresql/extension *.sql
'';
meta = with lib; {
description = "Full text search index method for PostgreSQL";
homepage = "https://github.com/postgrespro/rum";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ DeeUnderscore ];
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchgit, postgresql }:
stdenv.mkDerivation rec {
pname = "smlar-unstable";
version = "2020-10-07";
src = fetchgit {
url = "git://sigaev.ru/smlar.git";
rev = "25a4fef344f5c2b90e6a9d32144ee12b9198487d";
sha256 = "14mj63mbkcphrzw6890pb5n8igh27i9g7kh4wjdhgx3g7llbjbdw";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
meta = with lib; {
description = "Compute similary of any one-dimensional arrays";
homepage = "http://sigaev.ru/git/gitweb.cgi?p=smlar.git";
platforms = postgresql.meta.platforms;
license = licenses.bsd2;
maintainers = [ maintainers.marsam ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql, freetds }:
stdenv.mkDerivation rec {
pname = "tds_fdw";
# Move to stable version when it's released.
version = "unstable-2021-12-14";
buildInputs = [ postgresql freetds ];
src = fetchFromGitHub {
owner = "tds-fdw";
repo = pname;
rev = "1611a2805f85d84f463ae50c4e0765cb9bed72dc";
sha256 = "sha256-SYHo/o9fJjB1yzN4vLJB0RrF3HEJ4MzmEO44/Jih/20=";
};
installPhase = ''
version="$(sed -En "s,^default_version *= *'([^']*)'.*,\1,p" tds_fdw.control)"
install -D tds_fdw.so -t $out/lib
install -D sql/tds_fdw.sql "$out/share/postgresql/extension/tds_fdw--$version.sql"
install -D tds_fdw.control -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)";
homepage = "https://github.com/tds-fdw/tds_fdw";
maintainers = [ maintainers.steve-chavez ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "temporal_tables";
version = "1.2.0";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "mlt";
repo = pname;
rev = "6cc86eb03d618d6b9fc09ae523f1a1e5228d22b5";
sha256 = "0ykv37rm511n5955mbh9dcp7pgg88z1nwgszav7z6pziaj3nba8x";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
broken = stdenv.isDarwin;
description = "Temporal Tables PostgreSQL Extension ";
homepage = "https://github.com/mlt/temporal_tables";
maintainers = with maintainers; [ ggpeti ];
platforms = postgresql.meta.platforms;
license = licenses.bsd2;
};
}

View file

@ -0,0 +1,49 @@
{ lib, stdenv, fetchFromGitHub, cmake, postgresql, openssl, libkrb5 }:
# # To enable on NixOS:
# config.services.postgresql = {
# extraPlugins = [ pkgs.timescaledb ];
# extraConfig = "shared_preload_libraries = 'timescaledb'";
# }
stdenv.mkDerivation rec {
pname = "timescaledb";
version = "2.7.0";
nativeBuildInputs = [ cmake ];
buildInputs = [ postgresql openssl libkrb5 ];
src = fetchFromGitHub {
owner = "timescale";
repo = "timescaledb";
rev = version;
sha256 = "sha256-h9mDa4dfr7ksIqd6OZg6L3jyiwPL+fmJJzoXFZH8mqM=";
};
cmakeFlags = [ "-DSEND_TELEMETRY_DEFAULT=OFF" "-DREGRESS_CHECKS=OFF" "-DTAP_CHECKS=OFF" ]
++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ];
# Fix the install phase which tries to install into the pgsql extension dir,
# and cannot be manually overridden. This is rather fragile but works OK.
postPatch = ''
for x in CMakeLists.txt sql/CMakeLists.txt; do
substituteInPlace "$x" \
--replace 'DESTINATION "''${PG_SHAREDIR}/extension"' "DESTINATION \"$out/share/postgresql/extension\""
done
for x in src/CMakeLists.txt src/loader/CMakeLists.txt tsl/src/CMakeLists.txt; do
substituteInPlace "$x" \
--replace 'DESTINATION ''${PG_PKGLIBDIR}' "DESTINATION \"$out/lib\""
done
'';
meta = with lib; {
description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space";
homepage = "https://www.timescale.com/";
changelog = "https://github.com/timescale/timescaledb/raw/${version}/CHANGELOG.md";
maintainers = with maintainers; [ volth marsam ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
broken = versionOlder postgresql.version "12";
};
}

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, postgresql }:
stdenv.mkDerivation {
pname = "tsearch-extras";
version = "0.4";
src = fetchFromGitHub {
owner = "zulip";
repo = "tsearch_extras";
rev = "84e78f00931c4ef261d98197d6b5d94fc141f742"; # no release tag?
sha256 = "18j0saqblg3jhrz38splk173xjwdf32c67ymm18m8n5y94h8d2ba";
};
nativenativeBuildInputs = [ pkg-config ];
buildInputs = [ postgresql ];
installPhase = ''
install -D tsearch_extras.so -t $out/lib/
install -D ./{tsearch_extras--1.0.sql,tsearch_extras.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "Provides a few PostgreSQL functions for a lower-level data full text search";
homepage = "https://github.com/zulip/tsearch_extras/";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ DerTim1 ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, bison, flex, postgresql }:
stdenv.mkDerivation rec {
pname = "wal2json";
version = "2.4";
src = fetchFromGitHub {
owner = "eulerto";
repo = "wal2json";
rev = "wal2json_${builtins.replaceStrings ["."] ["_"] version}";
sha256 = "sha256-EB+tCaILWsU9fDhqosl6EyMoYBd6SHISFfyxiZ9pNOk=";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension sql/*.sql
'';
meta = with lib; {
description = "PostgreSQL JSON output plugin for changeset extraction";
homepage = "https://github.com/eulerto/wal2json";
changelog = "https://github.com/eulerto/wal2json/releases/tag/wal2json_${version}";
maintainers = with maintainers; [ euank ];
platforms = postgresql.meta.platforms;
license = licenses.bsd3;
};
}

View file

@ -0,0 +1,70 @@
self: super: {
age = super.callPackage ./ext/age.nix { };
jsonb_deep_sum = super.callPackage ./ext/jsonb_deep_sum.nix { };
periods = super.callPackage ./ext/periods.nix { };
postgis = super.callPackage ./ext/postgis.nix { };
pg_auto_failover = super.callPackage ./ext/pg_auto_failover.nix { };
pg_bigm = super.callPackage ./ext/pg_bigm.nix { };
pg_ed25519 = super.callPackage ./ext/pg_ed25519.nix { };
pg_rational = super.callPackage ./ext/pg_rational.nix { };
pg_repack = super.callPackage ./ext/pg_repack.nix { };
pg_similarity = super.callPackage ./ext/pg_similarity.nix { };
pgroonga = super.callPackage ./ext/pgroonga.nix { };
pgvector = super.callPackage ./ext/pgvector.nix { };
plpgsql_check = super.callPackage ./ext/plpgsql_check.nix { };
plr = super.callPackage ./ext/plr.nix { };
plv8 = super.callPackage ./ext/plv8.nix {
v8 = self.v8_8_x;
};
pgjwt = super.callPackage ./ext/pgjwt.nix { };
cstore_fdw = super.callPackage ./ext/cstore_fdw.nix { };
pg_hll = super.callPackage ./ext/pg_hll.nix { };
pg_cron = super.callPackage ./ext/pg_cron.nix { };
pg_topn = super.callPackage ./ext/pg_topn.nix { };
pgtap = super.callPackage ./ext/pgtap.nix { };
pipelinedb = super.callPackage ./ext/pipelinedb.nix { };
smlar = super.callPackage ./ext/smlar.nix { };
temporal_tables = super.callPackage ./ext/temporal_tables.nix { };
timescaledb = super.callPackage ./ext/timescaledb.nix { };
tsearch_extras = super.callPackage ./ext/tsearch_extras.nix { };
tds_fdw = super.callPackage ./ext/tds_fdw.nix { };
pgrouting = super.callPackage ./ext/pgrouting.nix { };
pg_partman = super.callPackage ./ext/pg_partman.nix { };
pg_safeupdate = super.callPackage ./ext/pg_safeupdate.nix { };
repmgr = super.callPackage ./ext/repmgr.nix { };
rum = super.callPackage ./ext/rum.nix { };
wal2json = super.callPackage ./ext/wal2json.nix { };
}

View file

@ -0,0 +1,12 @@
--- a/src/common/exec.c 2014-09-04 20:19:12.236057588 +0200
+++ b/src/common/exec.c 2014-09-04 20:19:50.550251633 +0200
@@ -218,6 +218,9 @@
static int
resolve_symlinks(char *path)
{
+ // On NixOS we *want* stuff relative to symlinks.
+ return 0;
+
#ifdef HAVE_READLINK
struct stat buf;
char orig_wd[MAXPGPATH],

View file

@ -0,0 +1,14 @@
diff --git a/src/port/exec.c b/src/port/exec.c
index c79e8ba..42c4091 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -216,6 +216,9 @@ find_my_exec(const char *argv0, char *retpath)
static int
resolve_symlinks(char *path)
{
+ // On NixOS we *want* stuff relative to symlinks.
+ return 0;
+
#ifdef HAVE_READLINK
struct stat buf;
char orig_wd[MAXPGPATH],

View file

@ -0,0 +1,59 @@
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 29 May 2019 22:51:52 -0400
Subject: [PATCH] Add /postgresql suffix for Nix outputs
Nix outputs put the `name' in each store path like
/nix/store/...-<name>. This was confusing the Postgres make script
because it thought its data directory already had postgresql in its
directory. This lead to Postgres installing all of its fils in
$out/share. To fix this, we just look for postgres or psql in the part
after the / using make's notdir.
---
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 29 May 2019 22:51:52 -0400
Subject: [PATCH] Add /postgresql suffix for Nix outputs
Nix outputs put the `name' in each store path like
/nix/store/...-<name>. This was confusing the Postgres make script
because it thought its data directory already had postgresql in its
directory. This lead to Postgres installing all of its fils in
$out/share. To fix this, we just look for postgres or psql in the part
after the / using make's notdir.
---
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index b9d86acaa9..bce05464c3 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -102,15 +102,15 @@ datarootdir := @datarootdir@
bindir := @bindir@
datadir := @datadir@
-ifeq "$(findstring pgsql, $(datadir))" ""
-ifeq "$(findstring postgres, $(datadir))" ""
+ifeq "$(findstring pgsql, $(notdir $(datadir)))" ""
+ifeq "$(findstring postgres, $(notdir $(datadir)))" ""
override datadir := $(datadir)/postgresql
endif
endif
sysconfdir := @sysconfdir@
-ifeq "$(findstring pgsql, $(sysconfdir))" ""
-ifeq "$(findstring postgres, $(sysconfdir))" ""
+ifeq "$(findstring pgsql, $(notdir $(sysconfdir)))" ""
+ifeq "$(findstring postgres, $(notdir $(sysconfdir)))" ""
override sysconfdir := $(sysconfdir)/postgresql
endif
endif
@@ -136,8 +136,8 @@ endif
mandir := @mandir@
docdir := @docdir@
-ifeq "$(findstring pgsql, $(docdir))" ""
-ifeq "$(findstring postgres, $(docdir))" ""
+ifeq "$(findstring pgsql, $(notdir $(docdir)))" ""
+ifeq "$(findstring postgres, $(notdir $(docdir)))" ""
override docdir := $(docdir)/postgresql
endif
endif

View file

@ -0,0 +1,14 @@
diff -Naur postgresql-9.6.1-orig/src/common/config_info.c postgresql-9.6.1/src/common/config_info.c
--- postgresql-9.6.1-orig/src/common/config_info.c 2016-11-22 21:39:29.231929261 +0100
+++ postgresql-9.6.1/src/common/config_info.c 2016-11-22 23:36:53.685163543 +0100
@@ -118,7 +118,10 @@
i++;
configdata[i].name = pstrdup("PGXS");
+ strlcpy(path, "HARDCODED_PGXS_PATH", sizeof(path));
+/* commented out to be able to point to nix $out path
get_pkglib_path(my_exec_path, path);
+*/
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
cleanup_path(path);
configdata[i].setting = pstrdup(path);

View file

@ -0,0 +1,17 @@
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -220,11 +220,13 @@ show_sysconfdir(bool all)
static void
show_pgxs(bool all)
{
- char path[MAXPGPATH];
+ char path[MAXPGPATH] = "HARDCODED_PGXS_PATH";
if (all)
printf("PGXS = ");
+ /* commented out to be able to point to nix $out path
get_pkglib_path(mypath, path);
+ */
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
cleanup_path(path);
printf("%s\n", path);

View file

@ -0,0 +1,12 @@
diff -Naur postgresql-9.6.1-orig/src/include/fe_utils/print.h postgresql-9.6.1/src/include/fe_utils/print.h
--- postgresql-9.6.1-orig/src/include/fe_utils/print.h 2016-11-22 21:39:29.148932827 +0100
+++ postgresql-9.6.1/src/include/fe_utils/print.h 2016-11-22 21:39:36.283626258 +0100
@@ -18,7 +18,7 @@
/* This is not a particularly great place for this ... */
#ifndef __CYGWIN__
-#define DEFAULT_PAGER "more"
+#define DEFAULT_PAGER "less"
#else
#define DEFAULT_PAGER "less"
#endif

View file

@ -0,0 +1,12 @@
diff -Naur postgresql-9.2.7-orig/src/bin/psql/print.h postgresql-9.2.7/src/bin/psql/print.h
--- postgresql-9.2.7-orig/src/bin/psql/print.h 2014-02-17 14:38:15.000000000 -0500
+++ postgresql-9.2.7/src/bin/psql/print.h 2014-03-04 14:42:28.874014415 -0500
@@ -178,7 +178,7 @@
extern const printTextFormat *get_line_style(const printTableOpt *opt);
#ifndef __CYGWIN__
-#define DEFAULT_PAGER "more"
+#define DEFAULT_PAGER "less"
#else
#define DEFAULT_PAGER "less"
#endif

View file

@ -0,0 +1,13 @@
diff --git i/src/include/pg_config_manual.h w/src/include/pg_config_manual.h
index 8f3ec6bde1..4fc01e4a0a 100644
--- i/src/include/pg_config_manual.h
+++ w/src/include/pg_config_manual.h
@@ -201,7 +201,7 @@
* support them yet.
*/
#ifndef WIN32
-#define DEFAULT_PGSOCKET_DIR "/tmp"
+#define DEFAULT_PGSOCKET_DIR "/run/postgresql"
#else
#define DEFAULT_PGSOCKET_DIR ""
#endif

View file

@ -0,0 +1,13 @@
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
index 743401cb96..be5c5f61d2 100644
--- a/src/include/pg_config_manual.h
+++ b/src/include/pg_config_manual.h
@@ -179,7 +179,7 @@
* here's where to twiddle it. You can also override this at runtime
* with the postmaster's -k switch.
*/
-#define DEFAULT_PGSOCKET_DIR "/tmp"
+#define DEFAULT_PGSOCKET_DIR "/run/postgresql"
/*
* This is the default event source for Windows event log.

View file

@ -0,0 +1,29 @@
diff -ur postgresql-9.5.3-orig/src/port/path.c postgresql-9.5.3/src/port/path.c
--- postgresql-9.5.3-orig/src/port/path.c 2016-05-09 22:50:23.000000000 +0200
+++ postgresql-9.5.3/src/port/path.c 2016-08-29 22:44:10.507377613 +0200
@@ -714,7 +714,11 @@
void
get_lib_path(const char *my_exec_path, char *ret_path)
{
- make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
+ if(nix_pglibdir == NULL)
+ make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
+ else
+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
}
/*
@@ -723,7 +727,11 @@
void
get_pkglib_path(const char *my_exec_path, char *ret_path)
{
- make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
+ if(nix_pglibdir == NULL)
+ make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
+ else
+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
}
/*

View file

@ -0,0 +1,154 @@
{ stdenv
, lib
, fetchFromGitHub
, fetchpatch
, autoconf
, automake
, bison
, cmake
, libtool
, civetweb
, coreutils
, curl
, flex
, gnutls
, jemalloc
, libconfig
, libdaemon
, libev
, libgcrypt
, libinjection
, libmicrohttpd_0_9_70
, lz4
, nlohmann_json
, openssl
, pcre
, perl
, python2
, re2
, zlib
}:
stdenv.mkDerivation rec {
pname = "proxysql";
version = "2.3.2";
src = fetchFromGitHub {
owner = "sysown";
repo = pname;
rev = version;
sha256 = "13l4bf7zhfjy701qx9hfr40vlsm4d0pbfmwr5d6lf514xznvsnzl";
};
patches = [
./makefiles.patch
./dont-phone-home.patch
(fetchpatch {
url = "https://github.com/sysown/proxysql/pull/3402.patch";
sha256 = "079jjhvx32qxjczmsplkhzjn9gl7c2a3famssczmjv2ffs65vibi";
})
];
nativeBuildInputs = [
autoconf
automake
cmake
libtool
perl
python2
];
buildInputs = [
bison
curl
flex
gnutls
libgcrypt
openssl
zlib
];
GIT_VERSION = version;
dontConfigure = true;
# replace and fix some vendored dependencies
preBuild = /* sh */ ''
pushd deps
function replace_dep() {
local folder="$1"
local src="$2"
local symlink="$3"
local name="$4"
pushd "$folder"
rm -rf "$symlink"
if [ -d "$src" ]; then
cp -R "$src"/. "$symlink"
chmod -R u+w "$symlink"
else
tar xf "$src"
ln -s "$name" "$symlink"
fi
popd
}
${lib.concatMapStringsSep "\n"
(x: ''replace_dep "${x.f}" "${x.p.src}" "${x.p.pname or (builtins.parseDrvName x.p.name).name}" "${x.p.name}"'') [
{ f = "curl"; p = curl; }
{ f = "jemalloc"; p = jemalloc; }
{ f = "libconfig"; p = libconfig; }
{ f = "libdaemon"; p = libdaemon; }
{ f = "libev"; p = libev; }
{ f = "libinjection"; p = libinjection; }
{ f = "libmicrohttpd"; p = libmicrohttpd_0_9_70; }
{ f = "libssl"; p = openssl; }
{ f = "lz4"; p = lz4; }
{ f = "pcre"; p = pcre; }
{ f = "re2"; p = re2; }
]}
pushd libhttpserver
tar xf libhttpserver-0.18.1.tar.gz
sed -i s_/bin/pwd_${coreutils}/bin/pwd_g libhttpserver/configure.ac
popd
pushd json
rm json.hpp
ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp .
popd
pushd prometheus-cpp
tar xf v0.9.0.tar.gz
replace_dep prometheus-cpp/3rdparty "${civetweb.src}" civetweb
popd
sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config
# https://github.com/sysown/proxysql/issues/3679
# TODO: remove when upgrading past 2.3.2
sed -i -e 's@^\(\s\+cd curl/curl \&\& ./configure .*\) \(--with-ssl=.*\)$@\1 --without-zstd \2@' Makefile
popd
patchShebangs .
'';
preInstall = ''
mkdir -p $out/{etc,bin,lib/systemd/system}
'';
postInstall = ''
sed -i s_/usr/bin/proxysql_$out/bin/proxysql_ $out/lib/systemd/system/*.service
'';
meta = with lib; {
homepage = "https://proxysql.com/";
broken = stdenv.isDarwin;
description = "High-performance MySQL proxy";
license = with licenses; [ gpl3Only ];
maintainers = with maintainers; [ ajs124 ];
};
}

View file

@ -0,0 +1,12 @@
diff --git a/src/main.cpp b/src/main.cpp
index 39dfaa24..634b004b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -237,6 +237,7 @@ static char * main_check_latest_version() {
void * main_check_latest_version_thread(void *arg) {
+ return NULL;
char * latest_version = main_check_latest_version();
if (latest_version) {
if (

View file

@ -0,0 +1,172 @@
--- a/Makefile
+++ b/Makefile
@@ -46,11 +46,7 @@ endif
export MAKEOPT=-j ${NPROCS}
-ifeq ($(wildcard /usr/lib/systemd/system), /usr/lib/systemd/system)
- SYSTEMD=1
-else
- SYSTEMD=0
-endif
+SYSTEMD=1
USERCHECK := $(shell getent passwd proxysql)
GROUPCHECK := $(shell getent group proxysql)
@@ -523,16 +519,10 @@ cleanbuild:
.PHONY: install
install: src/proxysql
- install -m 0755 src/proxysql /usr/bin
- install -m 0600 etc/proxysql.cnf /etc
- if [ ! -d /var/lib/proxysql ]; then mkdir /var/lib/proxysql ; fi
-ifeq ($(findstring proxysql,$(USERCHECK)),)
- @echo "Creating proxysql user and group"
- useradd -r -U -s /bin/false proxysql
-endif
+ install -m 0755 src/proxysql $(out)/bin
+ install -m 0600 etc/proxysql.cnf $(out)/etc
ifeq ($(SYSTEMD), 1)
- install -m 0644 systemd/system/proxysql.service /usr/lib/systemd/system/
- systemctl enable proxysql.service
+ install -m 0644 systemd/system/proxysql.service $(out)/lib/systemd/system/
else
install -m 0755 etc/init.d/proxysql /etc/init.d
ifeq ($(DISTRO),"CentOS Linux")
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -40,22 +40,10 @@ endif
libinjection/libinjection/src/libinjection.a:
- cd libinjection && rm -rf libinjection-3.10.0 || true
- cd libinjection && tar -zxf libinjection-3.10.0.tar.gz
- sed -i -e 's/python/python2/' libinjection/libinjection-3.10.0/src/make_parens.py
- sed -i -e 's/python/python2/' libinjection/libinjection-3.10.0/src/sqlparse_map.py
- sed -i -e 's/python/python2/' libinjection/libinjection-3.10.0/src/sqlparse2c.py
cd libinjection/libinjection && CC=${CC} CXX=${CXX} ${MAKE}
libinjection: libinjection/libinjection/src/libinjection.a
libssl/openssl/libssl.a:
-# cd libssl && rm -rf openssl-1.1.0h || true
-# cd libssl && tar -zxf openssl-1.1.0h.tar.gz
- cd libssl && rm -rf openssl-1.1.1d || true
- cd libssl && rm -rf openssl-1.1.0h || true
- cd libssl && rm -rf openssl-1.1.1g || true
- cd libssl && rm -rf openssl-1.1.1j || true
- cd libssl && tar -zxf openssl-1.1.1j.tar.gz
cd libssl/openssl && ./config no-ssl3
cd libssl/openssl && CC=${CC} CXX=${CXX} ${MAKE}
cd libssl/openssl && ln -s . lib # curl wants this path
@@ -70,9 +58,6 @@ ifeq ($(MIN_VERSION),$(lastword $(sort $(GCC_VERSION) $(MIN_VERSION))))
endif
libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
- cd libhttpserver && rm -rf libhttpserver-master_20191121 || true
- cd libhttpserver && rm -rf libhttpserver-0.18.1 || true
- cd libhttpserver && tar -zxf libhttpserver-0.18.1.tar.gz
ifeq ($(REQUIRE_PATCH), true)
cd libhttpserver/libhttpserver && patch src/httpserver/basic_auth_fail_response.hpp < ../basic_auth_fail_response.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/create_webserver.hpp < ../create_webserver.hpp.patch
@@ -94,34 +79,15 @@ endif
libhttpserver: libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a
libev/libev/.libs/libev.a:
- cd libev && rm -rf libev-4.24 || true
- cd libev && tar -zxf libev-4.24.tar.gz
cd libev/libev && ./configure
cd libev/libev && CC=${CC} CXX=${CXX} ${MAKE}
ev: libev/libev/.libs/libev.a
curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a
- cd curl && rm -rf curl-7.57.0 || true
- cd curl && rm -rf curl-7.77.0 || true
- cd curl && tar -zxf curl-7.77.0.tar.gz
- #cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --with-ssl=$(shell pwd)/../../libssl/openssl/ && CC=${CC} CXX=${CXX} ${MAKE}
cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=no && CC=${CC} CXX=${CXX} ${MAKE}
curl: curl/curl/lib/.libs/libcurl.a
libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a:
- cd libmicrohttpd && rm -rf libmicrohttpd-0.9.55 || true
- cd libmicrohttpd && rm -rf libmicrohttpd-0.9.68 || true
- cd libmicrohttpd && rm -f libmicrohttpd || true
-ifeq ($(CENTOSVER),6)
- cd libmicrohttpd && ln -s libmicrohttpd-0.9.55 libmicrohttpd
- cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.55.tar.gz
-else
- cd libmicrohttpd && ln -s libmicrohttpd-0.9.68 libmicrohttpd
- cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.68.tar.gz
-endif
-ifeq ($(OS),Darwin)
- cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/mhd_sockets.c < ../mhd_sockets.c-issue-5977.patch
-endif
cd libmicrohttpd/libmicrohttpd && ./configure --enable-https && CC=${CC} CXX=${CXX} ${MAKE}
microhttpd: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
@@ -132,8 +98,6 @@ cityhash/cityhash/src/.libs/libcityhash.a:
cityhash: cityhash/cityhash/src/.libs/libcityhash.a
lz4/lz4/liblz4.a:
- cd lz4 && rm -rf lz4-1.7.5 || true
- cd lz4 && tar -zxf lz4-1.7.5.tar.gz
cd lz4/lz4 && CC=${CC} CXX=${CXX} ${MAKE}
lz4: lz4/lz4/liblz4.a
@@ -148,16 +112,12 @@ clickhouse-cpp: clickhouse-cpp/clickhouse-cpp/clickhouse/libclickhouse-cpp-lib.a
libdaemon/libdaemon/libdaemon/.libs/libdaemon.a:
- cd libdaemon && rm -rf libdaemon-0.14
- cd libdaemon && tar -zxf libdaemon-0.14.tar.gz
cd libdaemon/libdaemon && cp ../config.guess . && chmod +x config.guess && ./configure --disable-examples
cd libdaemon/libdaemon && CC=${CC} CXX=${CXX} ${MAKE}
libdaemon: libdaemon/libdaemon/libdaemon/.libs/libdaemon.a
jemalloc/jemalloc/lib/libjemalloc.a:
- cd jemalloc && rm -rf jemalloc-5.2.0
- cd jemalloc && tar -jxf jemalloc-5.2.0.tar.bz2
cd jemalloc/jemalloc && patch src/jemalloc.c < ../issue823.520.patch
cd jemalloc/jemalloc && patch src/jemalloc.c < ../issue2358.patch
cd jemalloc/jemalloc && ./configure ${MYJEOPT}
@@ -210,17 +170,12 @@ sqlite3/sqlite3/sqlite3.o:
sqlite3: sqlite3/sqlite3/sqlite3.o
libconfig/libconfig/lib/.libs/libconfig++.a:
- cd libconfig && rm -rf libconfig-1.7.2
- cd libconfig && tar -zxf libconfig-1.7.2.tar.gz
cd libconfig/libconfig && ./configure --disable-examples
cd libconfig/libconfig && CC=${CC} CXX=${CXX} ${MAKE}
libconfig: libconfig/libconfig/lib/.libs/libconfig++.a
prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
- cd prometheus-cpp && rm -rf prometheus-cpp-0.9.0
- cd prometheus-cpp && tar -zxf v0.9.0.tar.gz
- cd prometheus-cpp && tar --strip-components=1 -zxf civetweb-v1.11.tar.gz -C prometheus-cpp/3rdparty/civetweb
cd prometheus-cpp/prometheus-cpp && patch -p1 < ../serial_exposer.patch
cd prometheus-cpp/prometheus-cpp && patch -p0 < ../registry_counters_reset.patch
cd prometheus-cpp/prometheus-cpp && cmake . -DBUILD_SHARED_LIBS=OFF -DENABLE_TESTING=OFF -DENABLE_PUSH=OFF
@@ -229,12 +184,6 @@ prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
prometheus-cpp: prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a
re2/re2/obj/libre2.a:
- cd re2 && rm -rf re2-2018-07-01 || true
- cd re2 && rm -rf re2-2020-07-06 || true
-# cd re2 && tar -zxf re2-20140304.tgz
- cd re2 && tar -zxf re2.tar.gz
-# cd re2/re2 && sed -i -e 's/-O3 -g /-O3 -fPIC /' Makefile
-# cd re2 && patch re2/util/mutex.h < mutex.h.patch
cd re2/re2 && sed -i -e 's/-O3 /-O3 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
cd re2/re2 && sed -i -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
cd re2/re2 && CC=${CC} CXX=${CXX} ${MAKE}
@@ -242,9 +191,6 @@ re2/re2/obj/libre2.a:
re2: re2/re2/obj/libre2.a
pcre/pcre/.libs/libpcre.a:
- cd pcre && rm -rf pcre-8.39
- cd pcre && rm -rf pcre-8.44
- cd pcre && tar -zxf pcre-8.44.tar.gz
cd pcre/pcre && ./configure
cd pcre/pcre && CC=${CC} CXX=${CXX} ${MAKE}
pcre: pcre/pcre/.libs/libpcre.a

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchMavenArtifact }:
stdenv.mkDerivation rec {
pname = "sqlite-jdbc";
version = "3.25.2";
src = fetchMavenArtifact {
groupId = "org.xerial";
artifactId = "sqlite-jdbc";
inherit version;
sha256 = "1xk5fi2wzq3jspvbdm5hvs78501i14jy3v7x6fjnh5fnpqdacpd4";
};
installPhase = ''
install -m444 -D ${src}/share/java/*${pname}-${version}.jar "$out/share/java/${pname}-${version}.jar"
'';
meta = with lib; {
homepage = "https://github.com/xerial/sqlite-jdbc";
description = "Library for accessing and creating SQLite database files in Java";
license = licenses.asl20;
sourceProvenance = with sourceTypes; [ binaryBytecode ];
platforms = platforms.linux;
maintainers = with maintainers; [ jraygauthier ];
};
}