From c35114cffec868e920299df829076a180346edcc Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 16 Oct 2024 12:22:43 -0400 Subject: [PATCH 1/6] feat: packaging and devshell with various cargo-pgrx versions! --- flake.lock | 37 +++++- flake.nix | 100 +++++++++++----- nix/cargo-pgrx/buildPgrxExtension.nix | 161 ++++++++++++++++++++++++++ nix/cargo-pgrx/default.nix | 70 +++++++++++ nix/ext/wrappers/default.nix | 6 +- 5 files changed, 343 insertions(+), 31 deletions(-) create mode 100644 nix/cargo-pgrx/buildPgrxExtension.nix create mode 100644 nix/cargo-pgrx/default.nix diff --git a/flake.lock b/flake.lock index 3ee7c2d7f..2d05388c6 100644 --- a/flake.lock +++ b/flake.lock @@ -121,12 +121,47 @@ "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "nix-editor": "nix-editor", "nix2container": "nix2container", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_3", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1729045942, + "narHash": "sha256-HjmK0x5Zm2TK2vFpC7XBM2e3EDNVnAIuEoU2FkeN8xw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "9de3cea452d2401d6f93c06ad985178a4e11d1fc", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } }, "systems": { diff --git a/flake.nix b/flake.nix index 15f1a585a..d6c288cf6 100644 --- a/flake.nix +++ b/flake.nix @@ -6,9 +6,10 @@ flake-utils.url = "github:numtide/flake-utils"; nix2container.url = "github:nlewo/nix2container"; nix-editor.url = "github:snowfallorg/nix-editor"; + rust-overlay.url = "github:oxalica/rust-overlay"; }; - outputs = { self, nixpkgs, flake-utils, nix2container, nix-editor, ...}: + outputs = { self, nixpkgs, flake-utils, nix2container, nix-editor, rust-overlay, ...}: let gitRev = "vcs=${self.shortRev or "dirty"}+${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}"; @@ -53,10 +54,41 @@ }; inherit system; overlays = [ - # NOTE (aseipp): add any needed overlays here. in theory we could + # NOTE add any needed overlays here. in theory we could # pull them from the overlays/ directory automatically, but we don't # want to have an arbitrary order, since it might matter. being # explicit is better. + (import rust-overlay) + (final: prev: { + cargo-pgrx = final.callPackage ./nix/cargo-pgrx/default.nix { + inherit (final) lib; + inherit (final) darwin; + inherit (final) fetchCrate; + inherit (final) openssl; + inherit (final) pkg-config; + inherit (final) makeRustPlatform; + inherit (final) stdenv; + inherit (final) rust-bin; + }; + + buildPgrxExtension = final.callPackage ./nix/cargo-pgrx/buildPgrxExtension.nix { + inherit (final) cargo-pgrx; + inherit (final) lib; + inherit (final) Security; + inherit (final) pkg-config; + inherit (final) makeRustPlatform; + inherit (final) stdenv; + inherit (final) writeShellScriptBin; + }; + + buildPgrxExtension_0_11_3 = prev.buildPgrxExtension.override { + cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_11_3; + }; + + buildPgrxExtension_0_12_5 = prev.buildPgrxExtension.override { + cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_12_5; + }; + }) (final: prev: { postgresql = final.callPackage ./nix/postgresql/default.nix { inherit (final) lib; @@ -66,7 +98,6 @@ inherit (final) callPackage; }; }) - (import ./nix/overlays/cargo-pgrx-0-11-3.nix) ]; }; sfcgal = pkgs.callPackage ./nix/ext/sfcgal/sfcgal.nix { }; @@ -310,6 +341,8 @@ in postgresVersions //{ supabase-groonga = supabase-groonga; + cargo-pgrx_0_11_3 = pkgs.cargo-pgrx.cargo-pgrx_0_11_3; + cargo-pgrx_0_12_5 = pkgs.cargo-pgrx.cargo-pgrx_0_12_5; # PostgreSQL versions. psql_15 = makePostgres "15"; #psql_orioledb_16 = makeOrioleDbPostgres "16_23" postgresql_orioledb_16; @@ -566,10 +599,7 @@ packages = flake-utils.lib.flattenTree basePackages // { # Any extra packages we might want to include in our package # set can go here. - inherit (pkgs) - # NOTE: comes from our cargo-pgrx-0-11-3.nix overlay - cargo-pgrx_0_11_3; - + inherit (pkgs); }; # The list of exported 'checks' that are run with every run of 'nix @@ -603,28 +633,40 @@ # ambient $PATH environment when you run 'nix develop'. This is useful # for development and puts many convenient devtools instantly within # reach. - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - coreutils - just - nix-update - #pg_prove - shellcheck - ansible - ansible-lint - (packer.overrideAttrs (oldAttrs: { - version = "1.7.8"; - })) - - basePackages.start-server - basePackages.start-client - basePackages.start-replica - basePackages.migrate-tool - basePackages.sync-exts-versions - ]; - shellHook = '' - export HISTFILE=.history - ''; + devShells = { + default = pkgs.mkShell { + packages = with pkgs; [ + coreutils + just + nix-update + #pg_prove + shellcheck + ansible + ansible-lint + (packer.overrideAttrs (oldAttrs: { + version = "1.7.8"; + })) + + basePackages.start-server + basePackages.start-client + basePackages.start-replica + basePackages.migrate-tool + basePackages.sync-exts-versions + ]; + shellHook = '' + export HISTFILE=.history + ''; + }; + cargo-pgrx_0_11_3 = pkgs.mkShell { + packages = with basePackages; [ + cargo-pgrx_0_11_3 + ]; + }; + cargo-pgrx_0_12_5 = pkgs.mkShell { + packages = with basePackages; [ + cargo-pgrx_0_12_5 + ]; + }; }; } ); diff --git a/nix/cargo-pgrx/buildPgrxExtension.nix b/nix/cargo-pgrx/buildPgrxExtension.nix new file mode 100644 index 000000000..7c21bcbe3 --- /dev/null +++ b/nix/cargo-pgrx/buildPgrxExtension.nix @@ -0,0 +1,161 @@ +# preBuildAndTest and some small other bits +# taken from https://github.com/tcdi/pgrx/blob/v0.9.4/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-pgrx +, 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-pgrx 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-pgrx 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 +, usePgTestCheckFeature ? true +, ... +} @ args: +let + rustfmtInNativeBuildInputs = lib.lists.any (dep: lib.getName dep == "rustfmt") (args.nativeBuildInputs or []); +in + +assert lib.asserts.assertMsg ((args.installPhase or "") == "") + "buildPgrxExtensions overwrites the installPhase, so providing one does nothing"; +assert lib.asserts.assertMsg ((args.buildPhase or "") == "") + "buildPgrxExtensions 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"; + + pgrxPostgresMajor = lib.versions.major postgresql.version; + preBuildAndTest = '' + export PGRX_HOME=$(mktemp -d) + export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/" + cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev 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" "usePgTestCheckFeature" ]; + + # so we don't accidentally `(rustPlatform.buildRustPackage argsForBuildRustPackage) // { ... }` because + # we forgot parentheses + finalArgs = argsForBuildRustPackage // { + buildInputs = (args.buildInputs or [ ]) ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ]; + + nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ + cargo-pgrx + postgresql + pkg-config + rustPlatform.bindgenHook + ] ++ lib.optionals useFakeRustfmt [ fakeRustfmt ]; + + buildPhase = '' + runHook preBuild + + echo "Executing cargo-pgrx buildPhase" + ${preBuildAndTest} + ${maybeEnterBuildAndTestSubdir} + + PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \ + ${lib.optionalString stdenv.hostPlatform.isDarwin ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \ + cargo pgrx package \ + --pg-config ${lib.getDev 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 buildPgrxExtension install" + + ${maybeEnterBuildAndTestSubdir} + + cargo-pgrx pgrx stop all + + mv $out/${postgresql}/* $out + rm -rf $out/nix + + ${maybeLeaveBuildAndTestSubdir} + + runHook postInstall + ''; + + PGRX_PG_SYS_SKIP_BINDING_REWRITE = "1"; + CARGO_BUILD_INCREMENTAL = "false"; + RUST_BACKTRACE = "full"; + + checkNoDefaultFeatures = true; + checkFeatures = (args.checkFeatures or [ ]) ++ (lib.optionals usePgTestCheckFeature [ "pg_test" ]) ++ [ "pg${pgrxPostgresMajor}" ]; + }; +in +rustPlatform.buildRustPackage finalArgs \ No newline at end of file diff --git a/nix/cargo-pgrx/default.nix b/nix/cargo-pgrx/default.nix new file mode 100644 index 000000000..dc563f8bb --- /dev/null +++ b/nix/cargo-pgrx/default.nix @@ -0,0 +1,70 @@ +{ lib +, darwin +, fetchCrate +, openssl +, pkg-config +, makeRustPlatform +, stdenv +, rust-bin +}: +let + rustVersion = "1.80.0"; + rustPlatform = makeRustPlatform { + cargo = rust-bin.stable.${rustVersion}.default; + rustc = rust-bin.stable.${rustVersion}.default; + }; + generic = + { version + , hash + , cargoHash + }: + rustPlatform.buildRustPackage rec { + pname = "cargo-pgrx"; + inherit version; + src = fetchCrate { + inherit version pname hash; + }; + inherit cargoHash; + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + pkg-config + ]; + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + openssl + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + darwin.apple_sdk.frameworks.Security + ]; + + OPENSSL_DIR = "${openssl.dev}"; + OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; + OPENSSL_LIB_DIR = "${openssl.out}/lib"; + PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig"; + preCheck = '' + export PGRX_HOME=$(mktemp -d) + ''; + checkFlags = [ + # requires pgrx to be properly initialized with cargo pgrx init + "--skip=command::schema::tests::test_parse_managed_postmasters" + ]; + meta = with lib; { + description = "Build Postgres Extensions with Rust"; + homepage = "https://github.com/pgcentralfoundation/pgrx"; + changelog = "https://github.com/pgcentralfoundation/pgrx/releases/tag/v${version}"; + license = licenses.mit; + maintainers = with maintainers; [ happysalada ]; + mainProgram = "cargo-pgrx"; + }; + }; +in +{ + cargo-pgrx_0_11_3 = generic { + version = "0.11.3"; + hash = "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU="; + cargoHash = "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw="; + }; + cargo-pgrx_0_12_5 = generic { + version = "0.12.5"; + hash = "sha256-U2kF+qjQwMTaocv5f4p5y3qmPUsTzdvAp8mz9cn/COw="; + cargoHash = "sha256-nEgIOBGNG3TupA55/TgoXDPeJzjBjOGGfK+WjrH06VY="; + }; + inherit rustPlatform; +} \ No newline at end of file diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index 98d6a7cbc..3cf4cd0f0 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -8,8 +8,12 @@ , cargo , darwin , jq +, rust-bin }: - +let + rustVersion = "1.80.0"; + rust = rust-bin.stable.${rustVersion}.default; +in buildPgrxExtension_0_11_3 rec { pname = "supabase-wrappers"; version = "0.4.2"; From e1527148e03b6dbb898cae61e6b271330dde8bdd Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 16 Oct 2024 12:31:21 -0400 Subject: [PATCH 2/6] feat: cargo-pgrx_0_12_6 instead --- flake.nix | 10 +++++----- nix/cargo-pgrx/default.nix | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index d6c288cf6..a001615b3 100644 --- a/flake.nix +++ b/flake.nix @@ -85,8 +85,8 @@ cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_11_3; }; - buildPgrxExtension_0_12_5 = prev.buildPgrxExtension.override { - cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_12_5; + buildPgrxExtension_0_12_6 = prev.buildPgrxExtension.override { + cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_12_6; }; }) (final: prev: { @@ -342,7 +342,7 @@ postgresVersions //{ supabase-groonga = supabase-groonga; cargo-pgrx_0_11_3 = pkgs.cargo-pgrx.cargo-pgrx_0_11_3; - cargo-pgrx_0_12_5 = pkgs.cargo-pgrx.cargo-pgrx_0_12_5; + cargo-pgrx_0_12_6 = pkgs.cargo-pgrx.cargo-pgrx_0_12_6; # PostgreSQL versions. psql_15 = makePostgres "15"; #psql_orioledb_16 = makeOrioleDbPostgres "16_23" postgresql_orioledb_16; @@ -662,9 +662,9 @@ cargo-pgrx_0_11_3 ]; }; - cargo-pgrx_0_12_5 = pkgs.mkShell { + cargo-pgrx_0_12_6 = pkgs.mkShell { packages = with basePackages; [ - cargo-pgrx_0_12_5 + cargo-pgrx_0_12_6 ]; }; }; diff --git a/nix/cargo-pgrx/default.nix b/nix/cargo-pgrx/default.nix index dc563f8bb..fabdfdd74 100644 --- a/nix/cargo-pgrx/default.nix +++ b/nix/cargo-pgrx/default.nix @@ -61,10 +61,10 @@ in hash = "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU="; cargoHash = "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw="; }; - cargo-pgrx_0_12_5 = generic { - version = "0.12.5"; - hash = "sha256-U2kF+qjQwMTaocv5f4p5y3qmPUsTzdvAp8mz9cn/COw="; - cargoHash = "sha256-nEgIOBGNG3TupA55/TgoXDPeJzjBjOGGfK+WjrH06VY="; + cargo-pgrx_0_12_6 = generic { + version = "0.12.6"; + hash = "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA="; + cargoHash = "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w="; }; inherit rustPlatform; } \ No newline at end of file From 25e941809fa7c8067c3ea2abfc3b91d4b761f072 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 16 Oct 2024 14:32:12 -0400 Subject: [PATCH 3/6] feat: devshell with rust versions --- flake.nix | 83 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/flake.nix b/flake.nix index a001615b3..f34dcb8fb 100644 --- a/flake.nix +++ b/flake.nix @@ -633,41 +633,52 @@ # ambient $PATH environment when you run 'nix develop'. This is useful # for development and puts many convenient devtools instantly within # reach. - devShells = { - default = pkgs.mkShell { - packages = with pkgs; [ - coreutils - just - nix-update - #pg_prove - shellcheck - ansible - ansible-lint - (packer.overrideAttrs (oldAttrs: { - version = "1.7.8"; - })) - - basePackages.start-server - basePackages.start-client - basePackages.start-replica - basePackages.migrate-tool - basePackages.sync-exts-versions - ]; - shellHook = '' - export HISTFILE=.history - ''; - }; - cargo-pgrx_0_11_3 = pkgs.mkShell { - packages = with basePackages; [ - cargo-pgrx_0_11_3 - ]; - }; - cargo-pgrx_0_12_6 = pkgs.mkShell { - packages = with basePackages; [ - cargo-pgrx_0_12_6 - ]; - }; + + devShells = let + mkCargoPgrxDevShell = { pgrxVersion, rustVersion }: pkgs.mkShell { + packages = with pkgs; [ + basePackages."cargo-pgrx_${pgrxVersion}" + (rust-bin.stable.${rustVersion}.default.override { + extensions = [ "rust-src" ]; + }) + ]; + shellHook = '' + export HISTFILE=.history + ''; + }; + in { + default = pkgs.mkShell { + packages = with pkgs; [ + coreutils + just + nix-update + #pg_prove + shellcheck + ansible + ansible-lint + (packer.overrideAttrs (oldAttrs: { + version = "1.7.8"; + })) + + basePackages.start-server + basePackages.start-client + basePackages.start-replica + basePackages.migrate-tool + basePackages.sync-exts-versions + ]; + shellHook = '' + export HISTFILE=.history + ''; + }; + cargo-pgrx_0_11_3 = mkCargoPgrxDevShell { + pgrxVersion = "0_11_3"; + rustVersion = "1.80.0"; + }; + cargo-pgrx_0_12_6 = mkCargoPgrxDevShell { + pgrxVersion = "0_12_6"; + rustVersion = "1.80.0"; }; - } - ); + }; + } + ); } From adad4a6b9be0207a073d87e6dd20745ea26c1b9e Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 16 Oct 2024 14:45:48 -0400 Subject: [PATCH 4/6] rust versions in devshell + try to make wrappers build again --- nix/cargo-pgrx/default.nix | 2 +- nix/ext/wrappers/default.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/cargo-pgrx/default.nix b/nix/cargo-pgrx/default.nix index fabdfdd74..3050459e6 100644 --- a/nix/cargo-pgrx/default.nix +++ b/nix/cargo-pgrx/default.nix @@ -8,7 +8,7 @@ , rust-bin }: let - rustVersion = "1.80.0"; + rustVersion = "1.76.0"; rustPlatform = makeRustPlatform { cargo = rust-bin.stable.${rustVersion}.default; rustc = rust-bin.stable.${rustVersion}.default; diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index 3cf4cd0f0..d44af6b50 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -11,8 +11,8 @@ , rust-bin }: let - rustVersion = "1.80.0"; - rust = rust-bin.stable.${rustVersion}.default; + rustVersion = "1.76.0"; + cargo = rust-bin.stable.${rustVersion}.default; in buildPgrxExtension_0_11_3 rec { pname = "supabase-wrappers"; From 18ff7b0133b24de9ec377adaa0297a0e4efab2a1 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 17 Oct 2024 06:08:25 -0400 Subject: [PATCH 5/6] feat: override rust versions in buildPgrxExtension --- nix/ext/pg_graphql.nix | 7 +++++-- nix/ext/pg_jsonschema.nix | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nix/ext/pg_graphql.nix b/nix/ext/pg_graphql.nix index 08451e3cd..1a900a821 100644 --- a/nix/ext/pg_graphql.nix +++ b/nix/ext/pg_graphql.nix @@ -1,5 +1,8 @@ -{ lib, stdenv, fetchFromGitHub, postgresql, buildPgrxExtension_0_11_3, cargo }: - +{ lib, stdenv, fetchFromGitHub, postgresql, buildPgrxExtension_0_11_3, cargo, rust-bin }: +let + rustVersion = "1.76.0"; + cargo = rust-bin.stable.${rustVersion}.default; +in buildPgrxExtension_0_11_3 rec { pname = "pg_graphql"; version = "1.5.7"; diff --git a/nix/ext/pg_jsonschema.nix b/nix/ext/pg_jsonschema.nix index 6606d3aaa..f79efcd95 100644 --- a/nix/ext/pg_jsonschema.nix +++ b/nix/ext/pg_jsonschema.nix @@ -1,5 +1,8 @@ -{ lib, stdenv, fetchFromGitHub, postgresql, buildPgrxExtension_0_11_3, cargo }: - +{ lib, stdenv, fetchFromGitHub, postgresql, buildPgrxExtension_0_11_3, cargo, rust-bin }: +let + rustVersion = "1.76.0"; + cargo = rust-bin.stable.${rustVersion}.default; +in buildPgrxExtension_0_11_3 rec { pname = "pg_jsonschema"; version = "0.3.1"; From c5615ecd75eea03bbba0d21127382eb955dfed0f Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 17 Oct 2024 06:21:00 -0400 Subject: [PATCH 6/6] chore: newline --- nix/cargo-pgrx/buildPgrxExtension.nix | 2 +- nix/cargo-pgrx/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/cargo-pgrx/buildPgrxExtension.nix b/nix/cargo-pgrx/buildPgrxExtension.nix index 7c21bcbe3..89293ab62 100644 --- a/nix/cargo-pgrx/buildPgrxExtension.nix +++ b/nix/cargo-pgrx/buildPgrxExtension.nix @@ -158,4 +158,4 @@ let checkFeatures = (args.checkFeatures or [ ]) ++ (lib.optionals usePgTestCheckFeature [ "pg_test" ]) ++ [ "pg${pgrxPostgresMajor}" ]; }; in -rustPlatform.buildRustPackage finalArgs \ No newline at end of file +rustPlatform.buildRustPackage finalArgs diff --git a/nix/cargo-pgrx/default.nix b/nix/cargo-pgrx/default.nix index 3050459e6..2d5545927 100644 --- a/nix/cargo-pgrx/default.nix +++ b/nix/cargo-pgrx/default.nix @@ -67,4 +67,4 @@ in cargoHash = "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w="; }; inherit rustPlatform; -} \ No newline at end of file +}