Merge pull request #305572 from wolfgangwalther/remove-promscale-pgx

promscale_extension,buildPgxExtension: remove

authored by Mario Rodas and committed by GitHub 183a604e 2586912d

-381
-1
nixos/tests/all-tests.nix
··· 941 941 tiddlywiki = handleTest ./tiddlywiki.nix {}; 942 942 tigervnc = handleTest ./tigervnc.nix {}; 943 943 timescaledb = handleTest ./timescaledb.nix {}; 944 - promscale = handleTest ./promscale.nix {}; 945 944 timezone = handleTest ./timezone.nix {}; 946 945 tinc = handleTest ./tinc {}; 947 946 tinydns = handleTest ./tinydns.nix {};
-60
nixos/tests/promscale.nix
··· 1 - # mostly copied from ./timescaledb.nix which was copied from ./postgresql.nix 2 - # as it seemed unapproriate to test additional extensions for postgresql there. 3 - 4 - { system ? builtins.currentSystem 5 - , config ? { } 6 - , pkgs ? import ../.. { inherit system config; } 7 - }: 8 - 9 - with import ../lib/testing-python.nix { inherit system pkgs; }; 10 - with pkgs.lib; 11 - 12 - let 13 - postgresql-versions = import ../../pkgs/servers/sql/postgresql pkgs; 14 - test-sql = pkgs.writeText "postgresql-test" '' 15 - CREATE USER promscale SUPERUSER PASSWORD 'promscale'; 16 - CREATE DATABASE promscale OWNER promscale; 17 - ''; 18 - 19 - make-postgresql-test = postgresql-name: postgresql-package: makeTest { 20 - name = postgresql-name; 21 - meta = with pkgs.lib.maintainers; { 22 - maintainers = [ anpin ]; 23 - }; 24 - 25 - nodes.machine = { config, pkgs, ... }: 26 - { 27 - services.postgresql = { 28 - enable = true; 29 - package = postgresql-package; 30 - extraPlugins = ps: with ps; [ 31 - timescaledb 32 - promscale_extension 33 - ]; 34 - settings = { shared_preload_libraries = "timescaledb, promscale"; }; 35 - }; 36 - environment.systemPackages = with pkgs; [ promscale ]; 37 - }; 38 - 39 - testScript = '' 40 - machine.start() 41 - machine.wait_for_unit("postgresql") 42 - with subtest("Postgresql with extensions timescaledb and promscale is available just after unit start"): 43 - print(machine.succeed("sudo -u postgres psql -f ${test-sql}")) 44 - machine.succeed("sudo -u postgres psql promscale -c 'SHOW shared_preload_libraries;' | grep promscale") 45 - machine.succeed( 46 - "promscale --db.name promscale --db.password promscale --db.user promscale --db.ssl-mode allow --startup.install-extensions --startup.only" 47 - ) 48 - machine.succeed("sudo -u postgres psql promscale -c 'SELECT ps_trace.get_trace_retention_period();' | grep '(1 row)'") 49 - machine.shutdown() 50 - ''; 51 - }; 52 - #version 15 is not supported yet 53 - applicablePostgresqlVersions = filterAttrs (_: value: versionAtLeast value.version "12" && !(versionAtLeast value.version "15")) postgresql-versions; 54 - in 55 - mapAttrs' 56 - (name: package: { 57 - inherit name; 58 - value = make-postgresql-test name package; 59 - }) 60 - applicablePostgresqlVersions
-26
pkgs/development/tools/rust/cargo-pgx/0_6_1.nix
··· 1 - { lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, Security }: 2 - 3 - rustPlatform.buildRustPackage rec { 4 - pname = "cargo-pgx"; 5 - version = "0.6.1"; 6 - 7 - src = fetchCrate { 8 - inherit version pname; 9 - sha256 = "sha256-O4eHVbJBudybsPab+zr2eXnfheREMqLAHAKm2GDbfrs="; 10 - }; 11 - 12 - cargoSha256 = "sha256-MucGrA3qXgJOcT2LMNmoNOhQi8QA3LuqgZEHKycLCCo="; 13 - 14 - nativeBuildInputs = [ pkg-config ]; 15 - 16 - buildInputs = [ openssl ] 17 - ++ lib.optionals stdenv.isDarwin [ Security ]; 18 - 19 - meta = with lib; { 20 - description = "Cargo subcommand for ‘pgx’ to make Postgres extension development easy"; 21 - mainProgram = "cargo-pgx"; 22 - homepage = "https://github.com/tcdi/pgx/tree/v${version}/cargo-pgx"; 23 - license = licenses.mit; 24 - maintainers = with maintainers; [ typetetris ]; 25 - }; 26 - }
-26
pkgs/development/tools/rust/cargo-pgx/0_7_1.nix
··· 1 - { lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, Security }: 2 - 3 - rustPlatform.buildRustPackage rec { 4 - pname = "cargo-pgx"; 5 - version = "0.7.1"; 6 - 7 - src = fetchCrate { 8 - inherit version pname; 9 - sha256 = "sha256-t/gdlrBeP6KFkBFJiZUa8KKVJVYMf6753vQGKJdytss="; 10 - }; 11 - 12 - cargoSha256 = "sha256-muce9wT4LAJmfNLWWEShARnpZgglXe/KrfxlitmGgXk="; 13 - 14 - nativeBuildInputs = [ pkg-config ]; 15 - 16 - buildInputs = [ openssl ] 17 - ++ lib.optionals stdenv.isDarwin [ Security ]; 18 - 19 - meta = with lib; { 20 - description = "Cargo subcommand for ‘pgx’ to make Postgres extension development easy"; 21 - mainProgram = "cargo-pgx"; 22 - homepage = "https://github.com/tcdi/pgx/tree/v${version}/cargo-pgx"; 23 - license = licenses.mit; 24 - maintainers = with maintainers; [ typetetris ]; 25 - }; 26 - }
-26
pkgs/development/tools/rust/cargo-pgx/0_7_4.nix
··· 1 - { lib, stdenv, fetchCrate, rustPlatform, pkg-config, openssl, Security }: 2 - 3 - rustPlatform.buildRustPackage rec { 4 - pname = "cargo-pgx"; 5 - version = "0.7.4"; 6 - 7 - src = fetchCrate { 8 - inherit version pname; 9 - sha256 = "sha256-uyMWfxI+A8mws8oZFm2pmvr7hJgSNIb328SrVtIDGdA="; 10 - }; 11 - 12 - cargoSha256 = "sha256-RgpL/hJdfrtLDANs5U53m5a6aEEAhZ9SFOIM7V8xABM="; 13 - 14 - nativeBuildInputs = [ pkg-config ]; 15 - 16 - buildInputs = [ openssl ] 17 - ++ lib.optionals stdenv.isDarwin [ Security ]; 18 - 19 - meta = with lib; { 20 - description = "Cargo subcommand for ‘pgx’ to make Postgres extension development easy"; 21 - mainProgram = "cargo-pgx"; 22 - homepage = "https://github.com/tcdi/pgx/tree/v${version}/cargo-pgx"; 23 - license = licenses.mit; 24 - maintainers = with maintainers; [ typetetris ]; 25 - }; 26 - }
-160
pkgs/development/tools/rust/cargo-pgx/buildPgxExtension.nix
··· 1 - # preBuildAndTest and some small other bits 2 - # taken from https://github.com/tcdi/pgx/blob/v0.4.5/nix/extension.nix 3 - # (but now heavily modified) 4 - # which uses MIT License with the following license file 5 - # 6 - # MIT License 7 - # 8 - # Portions Copyright 2019-2021 ZomboDB, LLC. 9 - # Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <support@tcdi.com>. 10 - # All rights reserved. 11 - # 12 - # Permission is hereby granted, free of charge, to any person obtaining a copy 13 - # of this software and associated documentation files (the "Software"), to deal 14 - # in the Software without restriction, including without limitation the rights 15 - # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 - # copies of the Software, and to permit persons to whom the Software is 17 - # furnished to do so, subject to the following conditions: 18 - # 19 - # The above copyright notice and this permission notice shall be included in all 20 - # copies or substantial portions of the Software. 21 - # 22 - # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 - # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 - # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 - # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 - # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 - # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 28 - # SOFTWARE. 29 - 30 - { lib 31 - , cargo-pgx 32 - , pkg-config 33 - , rustPlatform 34 - , stdenv 35 - , Security 36 - , writeShellScriptBin 37 - }: 38 - 39 - # The idea behind: Use it mostly like rustPlatform.buildRustPackage and so 40 - # we hand most of the arguments down. 41 - # 42 - # Additional arguments are: 43 - # - `postgresql` postgresql package of the version of postgresql this extension should be build for. 44 - # Needs to be the build platform variant. 45 - # - `useFakeRustfmt` Whether to use a noop fake command as rustfmt. cargo-pgx tries to call rustfmt. 46 - # If the generated rust bindings aren't needed to use the extension, its a 47 - # unnecessary and heavy dependency. If you set this to true, you also 48 - # have to add `rustfmt` to `nativeBuildInputs`. 49 - 50 - { buildAndTestSubdir ? null 51 - , buildType ? "release" 52 - , buildFeatures ? [ ] 53 - , cargoBuildFlags ? [ ] 54 - , postgresql 55 - # cargo-pgx calls rustfmt on generated bindings, this is not strictly necessary, so we avoid the 56 - # dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g. 57 - # if you include the generated code in the output via postInstall. 58 - , useFakeRustfmt ? true 59 - , ... 60 - } @ args: 61 - let 62 - rustfmtInNativeBuildInputs = lib.lists.any (dep: lib.getName dep == "rustfmt") (args.nativeBuildInputs or []); 63 - in 64 - 65 - assert lib.asserts.assertMsg ((args.installPhase or "") == "") 66 - "buildPgxExtensions overwrites the installPhase, so providing one does nothing"; 67 - assert lib.asserts.assertMsg ((args.buildPhase or "") == "") 68 - "buildPgxExtensions overwrites the buildPhase, so providing one does nothing"; 69 - assert lib.asserts.assertMsg (useFakeRustfmt -> !rustfmtInNativeBuildInputs) 70 - "The parameter useFakeRustfmt is set to true, but rustfmt is included in nativeBuildInputs. Either set useFakeRustfmt to false or remove rustfmt from nativeBuildInputs."; 71 - assert lib.asserts.assertMsg (!useFakeRustfmt -> rustfmtInNativeBuildInputs) 72 - "The parameter useFakeRustfmt is set to false, but rustfmt is not included in nativeBuildInputs. Either set useFakeRustfmt to true or add rustfmt from nativeBuildInputs."; 73 - 74 - let 75 - fakeRustfmt = writeShellScriptBin "rustfmt" '' 76 - exit 0 77 - ''; 78 - maybeDebugFlag = lib.optionalString (buildType != "release") "--debug"; 79 - maybeEnterBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) '' 80 - export CARGO_TARGET_DIR="$(pwd)/target" 81 - pushd "${buildAndTestSubdir}" 82 - ''; 83 - maybeLeaveBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) "popd"; 84 - 85 - pgxPostgresMajor = lib.versions.major postgresql.version; 86 - preBuildAndTest = '' 87 - export PGX_HOME=$(mktemp -d) 88 - export PGDATA="$PGX_HOME/data-${pgxPostgresMajor}/" 89 - cargo-pgx pgx init "--pg${pgxPostgresMajor}" ${postgresql}/bin/pg_config 90 - echo "unix_socket_directories = '$(mktemp -d)'" > "$PGDATA/postgresql.conf" 91 - 92 - # This is primarily for Mac or other Nix systems that don't use the nixbld user. 93 - export USER="$(whoami)" 94 - pg_ctl start 95 - createuser -h localhost --superuser --createdb "$USER" || true 96 - pg_ctl stop 97 - ''; 98 - 99 - argsForBuildRustPackage = builtins.removeAttrs args [ "postgresql" "useFakeRustfmt" ]; 100 - 101 - # so we don't accidentally `(rustPlatform.buildRustPackage argsForBuildRustPackage) // { ... }` because 102 - # we forgot parentheses 103 - finalArgs = argsForBuildRustPackage // { 104 - buildInputs = (args.buildInputs or [ ]) ++ lib.optionals stdenv.isDarwin [ Security ]; 105 - 106 - nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ 107 - cargo-pgx 108 - postgresql 109 - pkg-config 110 - rustPlatform.bindgenHook 111 - ] ++ lib.optionals useFakeRustfmt [ fakeRustfmt ]; 112 - 113 - buildPhase = '' 114 - runHook preBuild 115 - 116 - echo "Executing cargo-pgx buildPhase" 117 - ${preBuildAndTest} 118 - ${maybeEnterBuildAndTestSubdir} 119 - 120 - NIX_PGLIBDIR="${postgresql}/lib" \ 121 - PGX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \ 122 - cargo-pgx pgx package \ 123 - --pg-config ${postgresql}/bin/pg_config \ 124 - ${maybeDebugFlag} \ 125 - --features "${builtins.concatStringsSep " " buildFeatures}" \ 126 - --out-dir "$out" 127 - 128 - ${maybeLeaveBuildAndTestSubdir} 129 - 130 - runHook postBuild 131 - ''; 132 - 133 - preCheck = preBuildAndTest + args.preCheck or ""; 134 - 135 - installPhase = '' 136 - runHook preInstall 137 - 138 - echo "Executing buildPgxExtension install" 139 - 140 - ${maybeEnterBuildAndTestSubdir} 141 - 142 - cargo-pgx pgx stop all 143 - 144 - mv $out/${postgresql}/* $out 145 - rm -rf $out/nix 146 - 147 - ${maybeLeaveBuildAndTestSubdir} 148 - 149 - runHook postInstall 150 - ''; 151 - 152 - PGX_PG_SYS_SKIP_BINDING_REWRITE = "1"; 153 - CARGO_BUILD_INCREMENTAL = "false"; 154 - RUST_BACKTRACE = "full"; 155 - 156 - checkNoDefaultFeatures = true; 157 - checkFeatures = (args.checkFeatures or [ ]) ++ [ "pg_test pg${pgxPostgresMajor}" ]; 158 - }; 159 - in 160 - rustPlatform.buildRustPackage finalArgs
-2
pkgs/servers/sql/postgresql/ext/default.nix
··· 99 99 100 100 pg_uuidv7 = super.callPackage ./pg_uuidv7.nix { }; 101 101 102 - promscale_extension = super.callPackage ./promscale_extension.nix { }; 103 - 104 102 repmgr = super.callPackage ./repmgr.nix { }; 105 103 106 104 rum = super.callPackage ./rum.nix { };
-59
pkgs/servers/sql/postgresql/ext/promscale_extension.nix
··· 1 - { lib 2 - , fetchFromGitHub 3 - , fetchpatch 4 - , buildPgxExtension 5 - , postgresql 6 - , stdenv 7 - , nixosTests 8 - }: 9 - 10 - buildPgxExtension rec { 11 - inherit postgresql; 12 - 13 - pname = "promscale_extension"; 14 - version = "0.8.0"; 15 - 16 - src = fetchFromGitHub { 17 - owner = "timescale"; 18 - repo = "promscale_extension"; 19 - rev = version; 20 - sha256 = "sha256-vyEfQMGguHrHYdBEEmbev29L2uCa/4xL9DpGIniUwfI="; 21 - }; 22 - 23 - cargoSha256 = "sha256-VK9DObkg4trcGUXxxISCd0zqU3vc1Qt6NxqpgKIARCQ="; 24 - 25 - cargoPatches = [ 26 - # there is a duplicate definition in the lock file which fails to build with buildRustPackage 27 - (fetchpatch { 28 - name = "cargo-vendor.patch"; 29 - url = "https://github.com/timescale/promscale_extension/commit/3048bd959430e9abc2c1d5c772ab6b4fc1dc6a95.patch"; 30 - hash = "sha256-xTk4Ml8GN06QlJdrvAdVK21r30ZR/S83y5A5jJPdOw4="; 31 - }) 32 - ]; 33 - 34 - preBuild = '' 35 - patchShebangs create-upgrade-symlinks.sh extract-extension-version.sh 36 - ## Hack to boostrap the build because some pgx commands require this file. It gets re-generated later. 37 - cp templates/promscale.control ./promscale.control 38 - ''; 39 - postInstall = '' 40 - ln -s $out/lib/promscale-${version}.so $out/lib/promscale.so 41 - ''; 42 - passthru.tests = { 43 - promscale = nixosTests.promscale; 44 - }; 45 - 46 - # tests take really long 47 - doCheck = false; 48 - 49 - meta = with lib; { 50 - description = "Promscale is an open source observability backend for metrics and traces powered by SQL"; 51 - homepage = "https://github.com/timescale/promscale_extension"; 52 - maintainers = with maintainers; [ anpin ]; 53 - platforms = postgresql.meta.platforms; 54 - license = licenses.unfree; 55 - 56 - # as it needs to be used with timescaledb, simply use the condition from there 57 - broken = versionAtLeast postgresql.version "15"; 58 - }; 59 - }
-8
pkgs/servers/sql/postgresql/generic.nix
··· 24 24 # JIT 25 25 , jitSupport 26 26 , nukeReferences, patchelf, llvmPackages 27 - , makeRustPlatform, buildPgxExtension, cargo, rustc 28 27 29 28 # PL/Python 30 29 , pythonSupport ? false ··· 235 234 inherit (llvmPackages) llvm; 236 235 postgresql = this; 237 236 stdenv = stdenv'; 238 - buildPgxExtension = buildPgxExtension.override { 239 - stdenv = stdenv'; 240 - rustPlatform = makeRustPlatform { 241 - stdenv = stdenv'; 242 - inherit rustc cargo; 243 - }; 244 - }; 245 237 }; 246 238 newSelf = self // scope; 247 239 newSuper = { callPackage = newScope (scope // this.pkgs); };
-13
pkgs/top-level/all-packages.nix
··· 16744 16744 cargo-outdated = callPackage ../development/tools/rust/cargo-outdated { 16745 16745 inherit (darwin.apple_sdk.frameworks) CoreFoundation CoreServices Security SystemConfiguration; 16746 16746 }; 16747 - cargo-pgx_0_6_1 = callPackage ../development/tools/rust/cargo-pgx/0_6_1.nix { 16748 - inherit (darwin.apple_sdk.frameworks) Security; 16749 - }; 16750 - cargo-pgx_0_7_1 = callPackage ../development/tools/rust/cargo-pgx/0_7_1.nix { 16751 - inherit (darwin.apple_sdk.frameworks) Security; 16752 - }; 16753 - cargo-pgx_0_7_4 = callPackage ../development/tools/rust/cargo-pgx/0_7_4.nix { 16754 - inherit (darwin.apple_sdk.frameworks) Security; 16755 - }; 16756 - cargo-pgx = cargo-pgx_0_7_4; 16757 - buildPgxExtension = callPackage ../development/tools/rust/cargo-pgx/buildPgxExtension.nix { 16758 - inherit (darwin.apple_sdk.frameworks) Security; 16759 - }; 16760 16747 inherit (callPackages ../development/tools/rust/cargo-pgrx { }) 16761 16748 cargo-pgrx_0_10_2 16762 16749 cargo-pgrx_0_11_2