diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 232f10d7c24d..6430a344ba24 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -941,7 +941,6 @@ in { tiddlywiki = handleTest ./tiddlywiki.nix {}; tigervnc = handleTest ./tigervnc.nix {}; timescaledb = handleTest ./timescaledb.nix {}; - promscale = handleTest ./promscale.nix {}; timezone = handleTest ./timezone.nix {}; tinc = handleTest ./tinc {}; tinydns = handleTest ./tinydns.nix {}; diff --git a/nixos/tests/promscale.nix b/nixos/tests/promscale.nix deleted file mode 100644 index da18628f2482..000000000000 --- a/nixos/tests/promscale.nix +++ /dev/null @@ -1,60 +0,0 @@ -# mostly copied from ./timescaledb.nix which was copied from ./postgresql.nix -# as it seemed unapproriate to test additional extensions for postgresql there. - -{ system ? builtins.currentSystem -, config ? { } -, pkgs ? import ../.. { inherit system config; } -}: - -with import ../lib/testing-python.nix { inherit system pkgs; }; -with pkgs.lib; - -let - postgresql-versions = import ../../pkgs/servers/sql/postgresql pkgs; - test-sql = pkgs.writeText "postgresql-test" '' - CREATE USER promscale SUPERUSER PASSWORD 'promscale'; - CREATE DATABASE promscale OWNER promscale; - ''; - - make-postgresql-test = postgresql-name: postgresql-package: makeTest { - name = postgresql-name; - meta = with pkgs.lib.maintainers; { - maintainers = [ anpin ]; - }; - - nodes.machine = { config, pkgs, ... }: - { - services.postgresql = { - enable = true; - package = postgresql-package; - extraPlugins = ps: with ps; [ - timescaledb - promscale_extension - ]; - settings = { shared_preload_libraries = "timescaledb, promscale"; }; - }; - environment.systemPackages = with pkgs; [ promscale ]; - }; - - testScript = '' - machine.start() - machine.wait_for_unit("postgresql") - with subtest("Postgresql with extensions timescaledb and promscale is available just after unit start"): - print(machine.succeed("sudo -u postgres psql -f ${test-sql}")) - machine.succeed("sudo -u postgres psql promscale -c 'SHOW shared_preload_libraries;' | grep promscale") - machine.succeed( - "promscale --db.name promscale --db.password promscale --db.user promscale --db.ssl-mode allow --startup.install-extensions --startup.only" - ) - machine.succeed("sudo -u postgres psql promscale -c 'SELECT ps_trace.get_trace_retention_period();' | grep '(1 row)'") - machine.shutdown() - ''; - }; - #version 15 is not supported yet - applicablePostgresqlVersions = filterAttrs (_: value: versionAtLeast value.version "12" && !(versionAtLeast value.version "15")) postgresql-versions; -in -mapAttrs' - (name: package: { - inherit name; - value = make-postgresql-test name package; - }) - applicablePostgresqlVersions diff --git a/pkgs/development/tools/rust/cargo-pgx/0_6_1.nix b/pkgs/development/tools/rust/cargo-pgx/0_6_1.nix deleted file mode 100644 index 8dbc22cdfd49..000000000000 --- a/pkgs/development/tools/rust/cargo-pgx/0_6_1.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, Security }: - -rustPlatform.buildRustPackage rec { - pname = "cargo-pgx"; - version = "0.6.1"; - - src = fetchCrate { - inherit version pname; - sha256 = "sha256-O4eHVbJBudybsPab+zr2eXnfheREMqLAHAKm2GDbfrs="; - }; - - cargoSha256 = "sha256-MucGrA3qXgJOcT2LMNmoNOhQi8QA3LuqgZEHKycLCCo="; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = [ openssl ] - ++ lib.optionals stdenv.isDarwin [ Security ]; - - meta = with lib; { - description = "Cargo subcommand for ‘pgx’ to make Postgres extension development easy"; - mainProgram = "cargo-pgx"; - homepage = "https://github.com/tcdi/pgx/tree/v${version}/cargo-pgx"; - license = licenses.mit; - maintainers = with maintainers; [ typetetris ]; - }; -} diff --git a/pkgs/development/tools/rust/cargo-pgx/0_7_1.nix b/pkgs/development/tools/rust/cargo-pgx/0_7_1.nix deleted file mode 100644 index 6dd8a0661bed..000000000000 --- a/pkgs/development/tools/rust/cargo-pgx/0_7_1.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, Security }: - -rustPlatform.buildRustPackage rec { - pname = "cargo-pgx"; - version = "0.7.1"; - - src = fetchCrate { - inherit version pname; - sha256 = "sha256-t/gdlrBeP6KFkBFJiZUa8KKVJVYMf6753vQGKJdytss="; - }; - - cargoSha256 = "sha256-muce9wT4LAJmfNLWWEShARnpZgglXe/KrfxlitmGgXk="; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = [ openssl ] - ++ lib.optionals stdenv.isDarwin [ Security ]; - - meta = with lib; { - description = "Cargo subcommand for ‘pgx’ to make Postgres extension development easy"; - mainProgram = "cargo-pgx"; - homepage = "https://github.com/tcdi/pgx/tree/v${version}/cargo-pgx"; - license = licenses.mit; - maintainers = with maintainers; [ typetetris ]; - }; -} diff --git a/pkgs/development/tools/rust/cargo-pgx/0_7_4.nix b/pkgs/development/tools/rust/cargo-pgx/0_7_4.nix deleted file mode 100644 index 0f2b3ef35c22..000000000000 --- a/pkgs/development/tools/rust/cargo-pgx/0_7_4.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, Security }: - -rustPlatform.buildRustPackage rec { - pname = "cargo-pgx"; - version = "0.7.4"; - - src = fetchCrate { - inherit version pname; - sha256 = "sha256-uyMWfxI+A8mws8oZFm2pmvr7hJgSNIb328SrVtIDGdA="; - }; - - cargoSha256 = "sha256-RgpL/hJdfrtLDANs5U53m5a6aEEAhZ9SFOIM7V8xABM="; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = [ openssl ] - ++ lib.optionals stdenv.isDarwin [ Security ]; - - meta = with lib; { - description = "Cargo subcommand for ‘pgx’ to make Postgres extension development easy"; - mainProgram = "cargo-pgx"; - homepage = "https://github.com/tcdi/pgx/tree/v${version}/cargo-pgx"; - license = licenses.mit; - maintainers = with maintainers; [ typetetris ]; - }; -} diff --git a/pkgs/development/tools/rust/cargo-pgx/buildPgxExtension.nix b/pkgs/development/tools/rust/cargo-pgx/buildPgxExtension.nix deleted file mode 100644 index 4b4f7f9d7486..000000000000 --- a/pkgs/development/tools/rust/cargo-pgx/buildPgxExtension.nix +++ /dev/null @@ -1,160 +0,0 @@ -# preBuildAndTest and some small other bits -# taken from https://github.com/tcdi/pgx/blob/v0.4.5/nix/extension.nix -# (but now heavily modified) -# which uses MIT License with the following license file -# -# MIT License -# -# Portions Copyright 2019-2021 ZomboDB, LLC. -# Portions Copyright 2021-2022 Technology Concepts & Design, Inc. . -# All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -{ lib -, cargo-pgx -, pkg-config -, rustPlatform -, stdenv -, Security -, writeShellScriptBin -}: - -# The idea behind: Use it mostly like rustPlatform.buildRustPackage and so -# we hand most of the arguments down. -# -# Additional arguments are: -# - `postgresql` postgresql package of the version of postgresql this extension should be build for. -# Needs to be the build platform variant. -# - `useFakeRustfmt` Whether to use a noop fake command as rustfmt. cargo-pgx tries to call rustfmt. -# If the generated rust bindings aren't needed to use the extension, its a -# unnecessary and heavy dependency. If you set this to true, you also -# have to add `rustfmt` to `nativeBuildInputs`. - -{ buildAndTestSubdir ? null -, buildType ? "release" -, buildFeatures ? [ ] -, cargoBuildFlags ? [ ] -, postgresql -# cargo-pgx calls rustfmt on generated bindings, this is not strictly necessary, so we avoid the -# dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g. -# if you include the generated code in the output via postInstall. -, useFakeRustfmt ? true -, ... -} @ args: -let - rustfmtInNativeBuildInputs = lib.lists.any (dep: lib.getName dep == "rustfmt") (args.nativeBuildInputs or []); -in - -assert lib.asserts.assertMsg ((args.installPhase or "") == "") - "buildPgxExtensions overwrites the installPhase, so providing one does nothing"; -assert lib.asserts.assertMsg ((args.buildPhase or "") == "") - "buildPgxExtensions overwrites the buildPhase, so providing one does nothing"; -assert lib.asserts.assertMsg (useFakeRustfmt -> !rustfmtInNativeBuildInputs) - "The parameter useFakeRustfmt is set to true, but rustfmt is included in nativeBuildInputs. Either set useFakeRustfmt to false or remove rustfmt from nativeBuildInputs."; -assert lib.asserts.assertMsg (!useFakeRustfmt -> rustfmtInNativeBuildInputs) - "The parameter useFakeRustfmt is set to false, but rustfmt is not included in nativeBuildInputs. Either set useFakeRustfmt to true or add rustfmt from nativeBuildInputs."; - -let - fakeRustfmt = writeShellScriptBin "rustfmt" '' - exit 0 - ''; - maybeDebugFlag = lib.optionalString (buildType != "release") "--debug"; - maybeEnterBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) '' - export CARGO_TARGET_DIR="$(pwd)/target" - pushd "${buildAndTestSubdir}" - ''; - maybeLeaveBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) "popd"; - - pgxPostgresMajor = lib.versions.major postgresql.version; - preBuildAndTest = '' - export PGX_HOME=$(mktemp -d) - export PGDATA="$PGX_HOME/data-${pgxPostgresMajor}/" - cargo-pgx pgx init "--pg${pgxPostgresMajor}" ${postgresql}/bin/pg_config - echo "unix_socket_directories = '$(mktemp -d)'" > "$PGDATA/postgresql.conf" - - # This is primarily for Mac or other Nix systems that don't use the nixbld user. - export USER="$(whoami)" - pg_ctl start - createuser -h localhost --superuser --createdb "$USER" || true - pg_ctl stop - ''; - - argsForBuildRustPackage = builtins.removeAttrs args [ "postgresql" "useFakeRustfmt" ]; - - # so we don't accidentally `(rustPlatform.buildRustPackage argsForBuildRustPackage) // { ... }` because - # we forgot parentheses - finalArgs = argsForBuildRustPackage // { - buildInputs = (args.buildInputs or [ ]) ++ lib.optionals stdenv.isDarwin [ Security ]; - - nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ - cargo-pgx - postgresql - pkg-config - rustPlatform.bindgenHook - ] ++ lib.optionals useFakeRustfmt [ fakeRustfmt ]; - - buildPhase = '' - runHook preBuild - - echo "Executing cargo-pgx buildPhase" - ${preBuildAndTest} - ${maybeEnterBuildAndTestSubdir} - - NIX_PGLIBDIR="${postgresql}/lib" \ - PGX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \ - cargo-pgx pgx package \ - --pg-config ${postgresql}/bin/pg_config \ - ${maybeDebugFlag} \ - --features "${builtins.concatStringsSep " " buildFeatures}" \ - --out-dir "$out" - - ${maybeLeaveBuildAndTestSubdir} - - runHook postBuild - ''; - - preCheck = preBuildAndTest + args.preCheck or ""; - - installPhase = '' - runHook preInstall - - echo "Executing buildPgxExtension install" - - ${maybeEnterBuildAndTestSubdir} - - cargo-pgx pgx stop all - - mv $out/${postgresql}/* $out - rm -rf $out/nix - - ${maybeLeaveBuildAndTestSubdir} - - runHook postInstall - ''; - - PGX_PG_SYS_SKIP_BINDING_REWRITE = "1"; - CARGO_BUILD_INCREMENTAL = "false"; - RUST_BACKTRACE = "full"; - - checkNoDefaultFeatures = true; - checkFeatures = (args.checkFeatures or [ ]) ++ [ "pg_test pg${pgxPostgresMajor}" ]; - }; -in -rustPlatform.buildRustPackage finalArgs diff --git a/pkgs/servers/sql/postgresql/ext/default.nix b/pkgs/servers/sql/postgresql/ext/default.nix index af78f47eebca..6166bda6b41d 100644 --- a/pkgs/servers/sql/postgresql/ext/default.nix +++ b/pkgs/servers/sql/postgresql/ext/default.nix @@ -99,8 +99,6 @@ self: super: { pg_uuidv7 = super.callPackage ./pg_uuidv7.nix { }; - promscale_extension = super.callPackage ./promscale_extension.nix { }; - repmgr = super.callPackage ./repmgr.nix { }; rum = super.callPackage ./rum.nix { }; diff --git a/pkgs/servers/sql/postgresql/ext/promscale_extension.nix b/pkgs/servers/sql/postgresql/ext/promscale_extension.nix deleted file mode 100644 index 80de9315d985..000000000000 --- a/pkgs/servers/sql/postgresql/ext/promscale_extension.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ lib -, fetchFromGitHub -, fetchpatch -, buildPgxExtension -, postgresql -, stdenv -, nixosTests -}: - -buildPgxExtension rec { - inherit postgresql; - - pname = "promscale_extension"; - version = "0.8.0"; - - src = fetchFromGitHub { - owner = "timescale"; - repo = "promscale_extension"; - rev = version; - sha256 = "sha256-vyEfQMGguHrHYdBEEmbev29L2uCa/4xL9DpGIniUwfI="; - }; - - cargoSha256 = "sha256-VK9DObkg4trcGUXxxISCd0zqU3vc1Qt6NxqpgKIARCQ="; - - cargoPatches = [ - # there is a duplicate definition in the lock file which fails to build with buildRustPackage - (fetchpatch { - name = "cargo-vendor.patch"; - url = "https://github.com/timescale/promscale_extension/commit/3048bd959430e9abc2c1d5c772ab6b4fc1dc6a95.patch"; - hash = "sha256-xTk4Ml8GN06QlJdrvAdVK21r30ZR/S83y5A5jJPdOw4="; - }) - ]; - - preBuild = '' - patchShebangs create-upgrade-symlinks.sh extract-extension-version.sh - ## Hack to boostrap the build because some pgx commands require this file. It gets re-generated later. - cp templates/promscale.control ./promscale.control - ''; - postInstall = '' - ln -s $out/lib/promscale-${version}.so $out/lib/promscale.so - ''; - passthru.tests = { - promscale = nixosTests.promscale; - }; - - # tests take really long - doCheck = false; - - meta = with lib; { - description = "Promscale is an open source observability backend for metrics and traces powered by SQL"; - homepage = "https://github.com/timescale/promscale_extension"; - maintainers = with maintainers; [ anpin ]; - platforms = postgresql.meta.platforms; - license = licenses.unfree; - - # as it needs to be used with timescaledb, simply use the condition from there - broken = versionAtLeast postgresql.version "15"; - }; -} diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index 7f9e561f877b..b1bd2a83fa45 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -24,7 +24,6 @@ let # JIT , jitSupport , nukeReferences, patchelf, llvmPackages - , makeRustPlatform, buildPgxExtension, cargo, rustc # PL/Python , pythonSupport ? false @@ -235,13 +234,6 @@ let inherit (llvmPackages) llvm; postgresql = this; stdenv = stdenv'; - buildPgxExtension = buildPgxExtension.override { - stdenv = stdenv'; - rustPlatform = makeRustPlatform { - stdenv = stdenv'; - inherit rustc cargo; - }; - }; }; newSelf = self // scope; newSuper = { callPackage = newScope (scope // this.pkgs); }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f7d53d5bcae2..541014645520 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16744,19 +16744,6 @@ with pkgs; cargo-outdated = callPackage ../development/tools/rust/cargo-outdated { inherit (darwin.apple_sdk.frameworks) CoreFoundation CoreServices Security SystemConfiguration; }; - cargo-pgx_0_6_1 = callPackage ../development/tools/rust/cargo-pgx/0_6_1.nix { - inherit (darwin.apple_sdk.frameworks) Security; - }; - cargo-pgx_0_7_1 = callPackage ../development/tools/rust/cargo-pgx/0_7_1.nix { - inherit (darwin.apple_sdk.frameworks) Security; - }; - cargo-pgx_0_7_4 = callPackage ../development/tools/rust/cargo-pgx/0_7_4.nix { - inherit (darwin.apple_sdk.frameworks) Security; - }; - cargo-pgx = cargo-pgx_0_7_4; - buildPgxExtension = callPackage ../development/tools/rust/cargo-pgx/buildPgxExtension.nix { - inherit (darwin.apple_sdk.frameworks) Security; - }; inherit (callPackages ../development/tools/rust/cargo-pgrx { }) cargo-pgrx_0_10_2 cargo-pgrx_0_11_2