From 440a0f6052aded14ead6be8896d23a0067d698aa Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:15:29 -0400 Subject: [PATCH 01/37] build(nix): fixing the kilobase cargo build. --- nix/ext/kilobase.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 5cdd0d63d..65ffb1583 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -24,6 +24,9 @@ buildPgrxExtension_0_15_0 rec { # Cargo.toml path if not at root cargoRoot = "apps/kbve/kilobase"; + + # Build only the kilobase package + cargoBuildFlags = [ "--package" "kilobase" ]; nativeBuildInputs = [ cargo ]; buildInputs = [ postgresql ]; From 6098bce6b185213c4cdbde4bcc6484ac327c3548 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:18:57 -0400 Subject: [PATCH 02/37] build(nix): updating kilobase not to use the cargo lock. --- nix/ext/kilobase.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 65ffb1583..ae0deb6d9 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -19,6 +19,7 @@ buildPgrxExtension_0_15_0 rec { owner = "KBVE"; repo = "kbve"; rev = "main"; # Use main branch or specific commit hash + # If you have a specific commit without edition 2024 requirements, use that instead hash = "sha256-AKsvBd1UR28/o269Ys3lZzYkCRXXZrIgurE9C9lsW+Y="; }; @@ -49,13 +50,7 @@ buildPgrxExtension_0_15_0 rec { ); }; - cargoLock = { - lockFile = "${src}/Cargo.lock"; - allowBuiltinFetchGit = true; - outputHashes = { - "jedi-0.2.0" = "sha256-23u6jB89ok7UUQMcHOcYA/4Lwq59JMEXbVx3gGPGOks="; - }; - }; + cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # TODO: Replace with actual cargoHash # Disable tests for now doCheck = false; From a2b7e593043fb6ba7644f2f566f311eb2d50f2b0 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:20:05 -0400 Subject: [PATCH 03/37] build(nix): patching around the jedi issue. --- nix/ext/kilobase.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index ae0deb6d9..fd25b5f43 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -50,7 +50,25 @@ buildPgrxExtension_0_15_0 rec { ); }; - cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # TODO: Replace with actual cargoHash + cargoLock = { + lockFile = "${src}/Cargo.lock"; + allowBuiltinFetchGit = true; + outputHashes = { + "jedi-0.2.0" = "sha256-23u6jB89ok7UUQMcHOcYA/4Lwq59JMEXbVx3gGPGOks="; + }; + }; + + # Override the workspace to exclude problematic members + prePatch = '' + # Create a minimal workspace that excludes jedi + cat > Cargo.toml << 'EOF' +[workspace] +members = [ + "apps/kbve/kilobase", +] +resolver = "2" +EOF + ''; # Disable tests for now doCheck = false; From 6e3b10671b1dde8b6135457843a5956427e98f56 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:26:49 -0400 Subject: [PATCH 04/37] build(nix): preparing the nix build for the new main hash. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index fd25b5f43..65145929e 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -20,7 +20,7 @@ buildPgrxExtension_0_15_0 rec { repo = "kbve"; rev = "main"; # Use main branch or specific commit hash # If you have a specific commit without edition 2024 requirements, use that instead - hash = "sha256-AKsvBd1UR28/o269Ys3lZzYkCRXXZrIgurE9C9lsW+Y="; + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # TODO: Replace with new hash after jedi edition change }; # Cargo.toml path if not at root From 231c554395d2736305485c8b0abb755f9ec905d6 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:28:04 -0400 Subject: [PATCH 05/37] build(nix): updating the kilobase hash. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 65145929e..2929cfce7 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -20,7 +20,7 @@ buildPgrxExtension_0_15_0 rec { repo = "kbve"; rev = "main"; # Use main branch or specific commit hash # If you have a specific commit without edition 2024 requirements, use that instead - hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # TODO: Replace with new hash after jedi edition change + hash = "sha256-opUg+oGe3WFWzEpHSWY+I9Uava32RUCCWCbSeDBuhFA="; }; # Cargo.toml path if not at root From f6a7e96aca57339221871ba2bdcdc553573bf684 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:45:09 -0400 Subject: [PATCH 06/37] build(nix): reseting the hash for the jedi crate. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 2929cfce7..bd9fb467f 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -54,7 +54,7 @@ buildPgrxExtension_0_15_0 rec { lockFile = "${src}/Cargo.lock"; allowBuiltinFetchGit = true; outputHashes = { - "jedi-0.2.0" = "sha256-23u6jB89ok7UUQMcHOcYA/4Lwq59JMEXbVx3gGPGOks="; + "jedi-0.2.0" = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Update this hash }; }; From 8775f928d3e61bc637210d44f1eec7ac8b330ae2 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:47:04 -0400 Subject: [PATCH 07/37] build(nix): updating the jedi hash. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index bd9fb467f..2929cfce7 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -54,7 +54,7 @@ buildPgrxExtension_0_15_0 rec { lockFile = "${src}/Cargo.lock"; allowBuiltinFetchGit = true; outputHashes = { - "jedi-0.2.0" = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Update this hash + "jedi-0.2.0" = "sha256-23u6jB89ok7UUQMcHOcYA/4Lwq59JMEXbVx3gGPGOks="; }; }; From 4a7643ed05b445f401b64daa0cd2f3a3e96b6c89 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:52:46 -0400 Subject: [PATCH 08/37] build(nix): need to reset the cache for kbve monorepo. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 2929cfce7..817d42a4f 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -20,7 +20,7 @@ buildPgrxExtension_0_15_0 rec { repo = "kbve"; rev = "main"; # Use main branch or specific commit hash # If you have a specific commit without edition 2024 requirements, use that instead - hash = "sha256-opUg+oGe3WFWzEpHSWY+I9Uava32RUCCWCbSeDBuhFA="; + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Force refresh to get latest repo }; # Cargo.toml path if not at root From 8960261c09f01b0afeb592af6863070dd1621011 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:54:29 -0400 Subject: [PATCH 09/37] build(nix): updating the cargo hash. --- nix/ext/kilobase.nix | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 817d42a4f..94ee2cd7a 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -50,25 +50,8 @@ buildPgrxExtension_0_15_0 rec { ); }; - cargoLock = { - lockFile = "${src}/Cargo.lock"; - allowBuiltinFetchGit = true; - outputHashes = { - "jedi-0.2.0" = "sha256-23u6jB89ok7UUQMcHOcYA/4Lwq59JMEXbVx3gGPGOks="; - }; - }; - - # Override the workspace to exclude problematic members - prePatch = '' - # Create a minimal workspace that excludes jedi - cat > Cargo.toml << 'EOF' -[workspace] -members = [ - "apps/kbve/kilobase", -] -resolver = "2" -EOF - ''; + # Use cargoHash instead of cargoLock to avoid monorepo workspace issues + cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # TODO: Replace with actual cargoHash # Disable tests for now doCheck = false; From 3a5bd80d6463968a7b4b1fad1923f7fc72b9b161 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:01:00 -0400 Subject: [PATCH 10/37] build(nix): updating the new hash. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 94ee2cd7a..0381449ca 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -20,7 +20,7 @@ buildPgrxExtension_0_15_0 rec { repo = "kbve"; rev = "main"; # Use main branch or specific commit hash # If you have a specific commit without edition 2024 requirements, use that instead - hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Force refresh to get latest repo + hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; }; # Cargo.toml path if not at root From e3248589051da05dc7106a4058c6dbf7c42b03da Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:04:24 -0400 Subject: [PATCH 11/37] build(nix): updating the kilobase reference again. --- nix/ext/kilobase.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 0381449ca..4fc12db27 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -50,8 +50,14 @@ buildPgrxExtension_0_15_0 rec { ); }; - # Use cargoHash instead of cargoLock to avoid monorepo workspace issues - cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # TODO: Replace with actual cargoHash + cargoLock = { + lockFile = "${src}/Cargo.lock"; + allowBuiltinFetchGit = true; + # outputHashes for any git dependencies (if needed) + # outputHashes = { + # "some-git-dep-0.1.0" = "sha256-..."; + # }; + }; # Disable tests for now doCheck = false; From 83003742882ddff267e55e30cd6a923378b55ef5 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:18:32 -0400 Subject: [PATCH 12/37] build(nix): preparing an isolated cargo toml at the root level. --- nix/ext/kilobase.nix | 46 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 4fc12db27..f588dac84 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -26,8 +26,10 @@ buildPgrxExtension_0_15_0 rec { # Cargo.toml path if not at root cargoRoot = "apps/kbve/kilobase"; - # Build only the kilobase package - cargoBuildFlags = [ "--package" "kilobase" ]; + # Build only the kilobase package, isolate from workspace members + cargoBuildFlags = [ + "--package" "kilobase" + ]; nativeBuildInputs = [ cargo ]; buildInputs = [ postgresql ]; @@ -39,6 +41,46 @@ buildPgrxExtension_0_15_0 rec { CARGO = "${cargo}/bin/cargo"; + # Environment variables to isolate build and prevent workspace interference + preBuild = '' + # Create a minimal Cargo.toml that only includes kilobase to avoid workspace issues + cd ${cargoRoot} + + # Backup original workspace Cargo.toml if it exists + if [ -f ../../../Cargo.toml ]; then + mv ../../../Cargo.toml ../../../Cargo.toml.bak + fi + + # Create a standalone Cargo.toml for this build + cat > ../../../Cargo.toml << 'EOF' +[package] +name = "kilobase-standalone" +version = "0.1.0" +edition = "2021" + +[workspace] +members = ["apps/kbve/kilobase"] +resolver = "2" + +# Profile overrides for kilobase +[profile.dev.package.kilobase] +panic = "unwind" + +[profile.release.package.kilobase] +panic = "unwind" +opt-level = 3 +lto = "fat" +codegen-units = 1 +EOF + ''; + + postBuild = '' + # Restore original Cargo.toml + if [ -f ../../../Cargo.toml.bak ]; then + mv ../../../Cargo.toml.bak ../../../Cargo.toml + fi + ''; + # Darwin env needs PGPORT to be unique for build to not clash with other pgrx extensions env = lib.optionalAttrs stdenv.isDarwin { POSTGRES_LIB = "${postgresql}/lib"; From e52d8a888edce4f5d37aa41d028a0c8dc827ef4c Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:24:45 -0400 Subject: [PATCH 13/37] build(nix): updating kilobase isolation. --- nix/ext/kilobase.nix | 95 ++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index f588dac84..d65148c30 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -1,6 +1,7 @@ { lib, stdenv, + pkgs, fetchFromGitHub, postgresql, buildPgrxExtension_0_15_0, @@ -8,20 +9,58 @@ }: let rustVersion = "1.85.0"; # Updated to support edition 2024 - cargo = rust-bin.stable.${rustVersion}.default; + cargo = rust-bin.stable.${rustVersion}.default.override { + extensions = [ "rust-src" "rustfmt" "clippy" ]; + }; in buildPgrxExtension_0_15_0 rec { pname = "kilobase"; version = "0.1.0"; inherit postgresql; - src = fetchFromGitHub { - owner = "KBVE"; - repo = "kbve"; - rev = "main"; # Use main branch or specific commit hash - # If you have a specific commit without edition 2024 requirements, use that instead - hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; - }; + src = let + # Fetch the full repo first + fullSrc = fetchFromGitHub { + owner = "KBVE"; + repo = "kbve"; + rev = "main"; # Use main branch or specific commit hash + hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; + }; + in pkgs.runCommand "kilobase-filtered-src" {} '' + # Copy the full source + cp -r ${fullSrc} $out + chmod -R +w $out + + # Create a minimal workspace Cargo.toml that only includes kilobase + cat > $out/Cargo.toml << 'EOF' +[workspace] +resolver = "2" +members = ["apps/kbve/kilobase"] + +# Profile overrides for kilobase (from original workspace) +[profile.dev.package.kilobase] +panic = "unwind" + +[profile.release.package.kilobase] +panic = "unwind" +opt-level = 3 +lto = "fat" +codegen-units = 1 +EOF + + # Remove problematic workspace members to prevent cargo from trying to process them + rm -rf $out/packages/rust/jedi || true + rm -rf $out/packages/rust/q || true + rm -rf $out/packages/rust/soul || true + rm -rf $out/packages/erust || true + rm -rf $out/packages/holy || true + rm -rf $out/apps/kbve/rust_kanban || true + rm -rf $out/apps/kbve/rust_api_profile || true + rm -rf $out/apps/rareicon || true + rm -rf $out/apps/experimental || true + rm -rf $out/apps/rentearth || true + rm -rf $out/apps/discord || true + ''; # Cargo.toml path if not at root cargoRoot = "apps/kbve/kilobase"; @@ -41,46 +80,6 @@ buildPgrxExtension_0_15_0 rec { CARGO = "${cargo}/bin/cargo"; - # Environment variables to isolate build and prevent workspace interference - preBuild = '' - # Create a minimal Cargo.toml that only includes kilobase to avoid workspace issues - cd ${cargoRoot} - - # Backup original workspace Cargo.toml if it exists - if [ -f ../../../Cargo.toml ]; then - mv ../../../Cargo.toml ../../../Cargo.toml.bak - fi - - # Create a standalone Cargo.toml for this build - cat > ../../../Cargo.toml << 'EOF' -[package] -name = "kilobase-standalone" -version = "0.1.0" -edition = "2021" - -[workspace] -members = ["apps/kbve/kilobase"] -resolver = "2" - -# Profile overrides for kilobase -[profile.dev.package.kilobase] -panic = "unwind" - -[profile.release.package.kilobase] -panic = "unwind" -opt-level = 3 -lto = "fat" -codegen-units = 1 -EOF - ''; - - postBuild = '' - # Restore original Cargo.toml - if [ -f ../../../Cargo.toml.bak ]; then - mv ../../../Cargo.toml.bak ../../../Cargo.toml - fi - ''; - # Darwin env needs PGPORT to be unique for build to not clash with other pgrx extensions env = lib.optionalAttrs stdenv.isDarwin { POSTGRES_LIB = "${postgresql}/lib"; From 96788ffad43944dac2727deaa034a12f7ba3dae8 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:26:01 -0400 Subject: [PATCH 14/37] build(nix): trying to isolate the kilobase plugin. --- nix/ext/kilobase.nix | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index d65148c30..666e9c613 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -26,12 +26,22 @@ buildPgrxExtension_0_15_0 rec { rev = "main"; # Use main branch or specific commit hash hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; }; - in pkgs.runCommand "kilobase-filtered-src" {} '' - # Copy the full source - cp -r ${fullSrc} $out + in pkgs.runCommand "kilobase-isolated-src" { + nativeBuildInputs = [ cargo ]; + CARGO = "${cargo}/bin/cargo"; + } '' + # Copy only the kilobase directory and necessary files + mkdir -p $out/apps/kbve + cp -r ${fullSrc}/apps/kbve/kilobase $out/apps/kbve/ + + # Copy any shared files that might be needed (like .gitignore, etc.) + if [ -f ${fullSrc}/.gitignore ]; then + cp ${fullSrc}/.gitignore $out/ + fi + chmod -R +w $out - # Create a minimal workspace Cargo.toml that only includes kilobase + # Create a standalone workspace Cargo.toml that only includes kilobase cat > $out/Cargo.toml << 'EOF' [workspace] resolver = "2" @@ -48,18 +58,18 @@ lto = "fat" codegen-units = 1 EOF - # Remove problematic workspace members to prevent cargo from trying to process them - rm -rf $out/packages/rust/jedi || true - rm -rf $out/packages/rust/q || true - rm -rf $out/packages/rust/soul || true - rm -rf $out/packages/erust || true - rm -rf $out/packages/holy || true - rm -rf $out/apps/kbve/rust_kanban || true - rm -rf $out/apps/kbve/rust_api_profile || true - rm -rf $out/apps/rareicon || true - rm -rf $out/apps/experimental || true - rm -rf $out/apps/rentearth || true - rm -rf $out/apps/discord || true + # Change to workspace root and generate a new Cargo.lock with only kilobase dependencies + cd $out + ${cargo}/bin/cargo generate-lockfile --offline || ${cargo}/bin/cargo generate-lockfile + + # Verify the lockfile was created + if [ ! -f Cargo.lock ]; then + echo "Failed to generate Cargo.lock" + exit 1 + fi + + echo "Generated isolated Cargo.lock for kilobase" + ls -la ''; # Cargo.toml path if not at root @@ -100,6 +110,13 @@ EOF # }; }; + # Override the default Cargo.toml generation to use our filtered workspace + postPatch = '' + # Make sure we're using our filtered workspace configuration + ls -la Cargo.toml + cat Cargo.toml + ''; + # Disable tests for now doCheck = false; From 1a3c366138a4f7d77b3e2a46daa065e00b5daf13 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:29:26 -0400 Subject: [PATCH 15/37] build(nix): added cargo hack to get around this workspace isolation issue. --- nix/ext/kilobase.nix | 116 ++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 666e9c613..2f7f7bc26 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -3,6 +3,7 @@ stdenv, pkgs, fetchFromGitHub, + fetchCrate, postgresql, buildPgrxExtension_0_15_0, rust-bin, @@ -12,76 +13,77 @@ let cargo = rust-bin.stable.${rustVersion}.default.override { extensions = [ "rust-src" "rustfmt" "clippy" ]; }; + + # Build cargo-hack for workspace isolation + cargo-hack = pkgs.rustPlatform.buildRustPackage rec { + pname = "cargo-hack"; + version = "0.6.37"; + + src = fetchCrate { + inherit pname version; + hash = "sha256-TzMzRHemfX7/NeFNNCS00az6v2XNs3qn/ya7LW5E5P0="; + }; + + cargoHash = "sha256-E8c0PEvOLJqNkHp0sHY7lRY6pIJ7xMmE6WUH2rL7WOc="; + + nativeBuildInputs = [ cargo ]; + + meta = with lib; { + description = "Cargo subcommand to provide various options useful for testing and continuous integration"; + homepage = "https://github.com/taiki-e/cargo-hack"; + license = with licenses; [ asl20 mit ]; + }; + }; in buildPgrxExtension_0_15_0 rec { pname = "kilobase"; version = "0.1.0"; inherit postgresql; - src = let - # Fetch the full repo first - fullSrc = fetchFromGitHub { - owner = "KBVE"; - repo = "kbve"; - rev = "main"; # Use main branch or specific commit hash - hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; - }; - in pkgs.runCommand "kilobase-isolated-src" { - nativeBuildInputs = [ cargo ]; - CARGO = "${cargo}/bin/cargo"; - } '' - # Copy only the kilobase directory and necessary files - mkdir -p $out/apps/kbve - cp -r ${fullSrc}/apps/kbve/kilobase $out/apps/kbve/ - - # Copy any shared files that might be needed (like .gitignore, etc.) - if [ -f ${fullSrc}/.gitignore ]; then - cp ${fullSrc}/.gitignore $out/ - fi - - chmod -R +w $out - - # Create a standalone workspace Cargo.toml that only includes kilobase - cat > $out/Cargo.toml << 'EOF' -[workspace] -resolver = "2" -members = ["apps/kbve/kilobase"] + src = fetchFromGitHub { + owner = "KBVE"; + repo = "kbve"; + rev = "main"; # Use main branch or specific commit hash + hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; + }; -# Profile overrides for kilobase (from original workspace) -[profile.dev.package.kilobase] -panic = "unwind" + # Cargo.toml path if not at root + cargoRoot = "apps/kbve/kilobase"; + + # Use cargo-hack for workspace isolation + cargoBuildFlags = [ ]; -[profile.release.package.kilobase] -panic = "unwind" -opt-level = 3 -lto = "fat" -codegen-units = 1 -EOF + nativeBuildInputs = [ cargo cargo-hack ]; + buildInputs = [ postgresql ]; - # Change to workspace root and generate a new Cargo.lock with only kilobase dependencies - cd $out - ${cargo}/bin/cargo generate-lockfile --offline || ${cargo}/bin/cargo generate-lockfile + # Override build commands to use cargo-hack for isolation + buildPhase = '' + runHook preBuild - # Verify the lockfile was created - if [ ! -f Cargo.lock ]; then - echo "Failed to generate Cargo.lock" - exit 1 - fi + cd ${cargoRoot} - echo "Generated isolated Cargo.lock for kilobase" - ls -la + # Use cargo-hack to build only this package in isolation + cargo hack build \ + --each-feature \ + --no-dev-deps \ + --release \ + --target-dir ../../../target + + runHook postBuild ''; - # Cargo.toml path if not at root - cargoRoot = "apps/kbve/kilobase"; - - # Build only the kilobase package, isolate from workspace members - cargoBuildFlags = [ - "--package" "kilobase" - ]; - - nativeBuildInputs = [ cargo ]; - buildInputs = [ postgresql ]; + installPhase = '' + runHook preInstall + + cd ${cargoRoot} + + # Install using cargo pgrx + cargo pgrx install \ + --release \ + --pg-config ${postgresql}/bin/pg_config + + runHook postInstall + ''; # Update this array when kilobase version is updated previousVersions = [ From d512779e9f91e9679051e88d5d1a7ca67f135529 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:31:08 -0400 Subject: [PATCH 16/37] build(nix): updating the cargo hack reference. --- nix/ext/kilobase.nix | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 2f7f7bc26..37c3e34e6 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -3,37 +3,16 @@ stdenv, pkgs, fetchFromGitHub, - fetchCrate, postgresql, buildPgrxExtension_0_15_0, rust-bin, + cargo-hack, }: let rustVersion = "1.85.0"; # Updated to support edition 2024 cargo = rust-bin.stable.${rustVersion}.default.override { extensions = [ "rust-src" "rustfmt" "clippy" ]; }; - - # Build cargo-hack for workspace isolation - cargo-hack = pkgs.rustPlatform.buildRustPackage rec { - pname = "cargo-hack"; - version = "0.6.37"; - - src = fetchCrate { - inherit pname version; - hash = "sha256-TzMzRHemfX7/NeFNNCS00az6v2XNs3qn/ya7LW5E5P0="; - }; - - cargoHash = "sha256-E8c0PEvOLJqNkHp0sHY7lRY6pIJ7xMmE6WUH2rL7WOc="; - - nativeBuildInputs = [ cargo ]; - - meta = with lib; { - description = "Cargo subcommand to provide various options useful for testing and continuous integration"; - homepage = "https://github.com/taiki-e/cargo-hack"; - license = with licenses; [ asl20 mit ]; - }; - }; in buildPgrxExtension_0_15_0 rec { pname = "kilobase"; From db5834648ec0efbdf68f811eeda46beafd0e80e1 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:32:31 -0400 Subject: [PATCH 17/37] build(nix): updating the kilobase reference. --- nix/ext/kilobase.nix | 90 ++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 37c3e34e6..da342331a 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -6,7 +6,6 @@ postgresql, buildPgrxExtension_0_15_0, rust-bin, - cargo-hack, }: let rustVersion = "1.85.0"; # Updated to support edition 2024 @@ -19,51 +18,33 @@ buildPgrxExtension_0_15_0 rec { version = "0.1.0"; inherit postgresql; - src = fetchFromGitHub { - owner = "KBVE"; - repo = "kbve"; - rev = "main"; # Use main branch or specific commit hash - hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; - }; + src = let + fullSrc = fetchFromGitHub { + owner = "KBVE"; + repo = "kbve"; + rev = "main"; # Use main branch or specific commit hash + hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; + }; + in pkgs.runCommand "kilobase-standalone-src" {} '' + # Copy only the kilobase source + mkdir -p $out + cp -r ${fullSrc}/apps/kbve/kilobase/* $out/ + chmod -R +w $out + + # Ensure we have a proper standalone Cargo.toml + ls -la $out/ + cat $out/Cargo.toml || echo "No Cargo.toml found" + ''; - # Cargo.toml path if not at root - cargoRoot = "apps/kbve/kilobase"; + # Since we're using the kilobase directory as root, no cargoRoot needed + # cargoRoot = ""; - # Use cargo-hack for workspace isolation + # No cargoBuildFlags needed since we're building the root package cargoBuildFlags = [ ]; - nativeBuildInputs = [ cargo cargo-hack ]; + nativeBuildInputs = [ cargo ]; buildInputs = [ postgresql ]; - # Override build commands to use cargo-hack for isolation - buildPhase = '' - runHook preBuild - - cd ${cargoRoot} - - # Use cargo-hack to build only this package in isolation - cargo hack build \ - --each-feature \ - --no-dev-deps \ - --release \ - --target-dir ../../../target - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - cd ${cargoRoot} - - # Install using cargo pgrx - cargo pgrx install \ - --release \ - --pg-config ${postgresql}/bin/pg_config - - runHook postInstall - ''; - # Update this array when kilobase version is updated previousVersions = [ # Add previous versions here when updating @@ -82,13 +63,32 @@ buildPgrxExtension_0_15_0 rec { ); }; + # Generate the Cargo.lock for this standalone package cargoLock = { - lockFile = "${src}/Cargo.lock"; + lockFile = let + fullSrc = fetchFromGitHub { + owner = "KBVE"; + repo = "kbve"; + rev = "main"; + hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; + }; + cargoLockSrc = pkgs.runCommand "kilobase-cargo-lock" { + nativeBuildInputs = [ cargo ]; + CARGO = "${cargo}/bin/cargo"; + } '' + # Copy the kilobase source + cp -r ${fullSrc}/apps/kbve/kilobase $out-temp + chmod -R +w $out-temp + cd $out-temp + + # Generate a fresh Cargo.lock for just this package + ${cargo}/bin/cargo generate-lockfile + + # Copy the generated lock file to output + cp Cargo.lock $out + ''; + in "${cargoLockSrc}"; allowBuiltinFetchGit = true; - # outputHashes for any git dependencies (if needed) - # outputHashes = { - # "some-git-dep-0.1.0" = "sha256-..."; - # }; }; # Override the default Cargo.toml generation to use our filtered workspace From 71bafdfdb1beb3d5ccf044dc791ef452ef0099f7 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:33:24 -0400 Subject: [PATCH 18/37] build(nix): trying another way to build the kilobase. --- nix/ext/kilobase.nix | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index da342331a..d4059aeee 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -63,31 +63,16 @@ buildPgrxExtension_0_15_0 rec { ); }; - # Generate the Cargo.lock for this standalone package - cargoLock = { - lockFile = let - fullSrc = fetchFromGitHub { - owner = "KBVE"; - repo = "kbve"; - rev = "main"; - hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; - }; - cargoLockSrc = pkgs.runCommand "kilobase-cargo-lock" { - nativeBuildInputs = [ cargo ]; - CARGO = "${cargo}/bin/cargo"; - } '' - # Copy the kilobase source - cp -r ${fullSrc}/apps/kbve/kilobase $out-temp - chmod -R +w $out-temp - cd $out-temp - - # Generate a fresh Cargo.lock for just this package - ${cargo}/bin/cargo generate-lockfile - - # Copy the generated lock file to output - cp Cargo.lock $out - ''; - in "${cargoLockSrc}"; + # Use the original Cargo.lock but only build kilobase + cargoLock = let + fullSrc = fetchFromGitHub { + owner = "KBVE"; + repo = "kbve"; + rev = "main"; + hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; + }; + in { + lockFile = "${fullSrc}/Cargo.lock"; allowBuiltinFetchGit = true; }; From 5a3e5a39789383bf341f737791793df5678d51af Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:41:22 -0400 Subject: [PATCH 19/37] build(nix): clearning cache --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index d4059aeee..f5eb4e1db 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -69,7 +69,7 @@ buildPgrxExtension_0_15_0 rec { owner = "KBVE"; repo = "kbve"; rev = "main"; - hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; + hash = ""; }; in { lockFile = "${fullSrc}/Cargo.lock"; From fdf5f474bfea87ac8aab31647e95846cf9b30b79 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:42:21 -0400 Subject: [PATCH 20/37] build(nix): updating the hash. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index f5eb4e1db..8d54b4705 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -69,7 +69,7 @@ buildPgrxExtension_0_15_0 rec { owner = "KBVE"; repo = "kbve"; rev = "main"; - hash = ""; + hash = "sha256-qlmJ1uJDpHxAsAksJJmkcfmCYe4W2XrSesGrQdDe7mI="; }; in { lockFile = "${fullSrc}/Cargo.lock"; From 62c29872a36c62183687c242e2f4cacde6d41657 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:52:59 -0400 Subject: [PATCH 21/37] build(nix): clearing the hash again for the main monorepo. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 8d54b4705..f5eb4e1db 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -69,7 +69,7 @@ buildPgrxExtension_0_15_0 rec { owner = "KBVE"; repo = "kbve"; rev = "main"; - hash = "sha256-qlmJ1uJDpHxAsAksJJmkcfmCYe4W2XrSesGrQdDe7mI="; + hash = ""; }; in { lockFile = "${fullSrc}/Cargo.lock"; From 53327e045d151accb158dce88b01ec16db91df2d Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:53:47 -0400 Subject: [PATCH 22/37] build(nix): updating the hash for the cargoLock. --- nix/ext/kilobase.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index f5eb4e1db..e5a84cd6c 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -69,7 +69,7 @@ buildPgrxExtension_0_15_0 rec { owner = "KBVE"; repo = "kbve"; rev = "main"; - hash = ""; + hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; }; in { lockFile = "${fullSrc}/Cargo.lock"; From 26e3d39596067d6451d4c781beadd0b0f034aa8d Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:05:43 -0400 Subject: [PATCH 23/37] build(nix): updating the build command again. --- nix/ext/kilobase.nix | 66 ++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index e5a84cd6c..b0a9e7859 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -18,33 +18,47 @@ buildPgrxExtension_0_15_0 rec { version = "0.1.0"; inherit postgresql; - src = let - fullSrc = fetchFromGitHub { - owner = "KBVE"; - repo = "kbve"; - rev = "main"; # Use main branch or specific commit hash - hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y="; - }; - in pkgs.runCommand "kilobase-standalone-src" {} '' - # Copy only the kilobase source - mkdir -p $out - cp -r ${fullSrc}/apps/kbve/kilobase/* $out/ - chmod -R +w $out - - # Ensure we have a proper standalone Cargo.toml - ls -la $out/ - cat $out/Cargo.toml || echo "No Cargo.toml found" - ''; + src = fetchFromGitHub { + owner = "KBVE"; + repo = "kbve"; + rev = "main"; # Use main branch or specific commit hash + hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; + }; - # Since we're using the kilobase directory as root, no cargoRoot needed - # cargoRoot = ""; + # Cargo.toml path if not at root + cargoRoot = "apps/kbve/kilobase"; - # No cargoBuildFlags needed since we're building the root package + # Override build to use cargo pgrx package command cargoBuildFlags = [ ]; nativeBuildInputs = [ cargo ]; buildInputs = [ postgresql ]; + # Override build phase to use the specific cargo pgrx package command + buildPhase = '' + runHook preBuild + + cd ${cargoRoot} + + # Use cargo pgrx package with specific features and output directory + cargo pgrx package \ + --pg-config ${postgresql}/bin/pg_config \ + --features pg17 \ + --out-dir ../../../dist/target/kilobase + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + # Install from the dist directory + mkdir -p $out + cp -r dist/target/kilobase/* $out/ + + runHook postInstall + ''; + # Update this array when kilobase version is updated previousVersions = [ # Add previous versions here when updating @@ -63,16 +77,8 @@ buildPgrxExtension_0_15_0 rec { ); }; - # Use the original Cargo.lock but only build kilobase - cargoLock = let - fullSrc = fetchFromGitHub { - owner = "KBVE"; - repo = "kbve"; - rev = "main"; - hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; - }; - in { - lockFile = "${fullSrc}/Cargo.lock"; + cargoLock = { + lockFile = "${src}/Cargo.lock"; allowBuiltinFetchGit = true; }; From 591a1046f62865a063624b6b424f3a8b78c9eb75 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:06:20 -0400 Subject: [PATCH 24/37] build(nix): overwriting the older build. --- nix/ext/kilobase.nix | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index b0a9e7859..c1a41d1de 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -34,30 +34,8 @@ buildPgrxExtension_0_15_0 rec { nativeBuildInputs = [ cargo ]; buildInputs = [ postgresql ]; - # Override build phase to use the specific cargo pgrx package command - buildPhase = '' - runHook preBuild - - cd ${cargoRoot} - - # Use cargo pgrx package with specific features and output directory - cargo pgrx package \ - --pg-config ${postgresql}/bin/pg_config \ - --features pg17 \ - --out-dir ../../../dist/target/kilobase - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - # Install from the dist directory - mkdir -p $out - cp -r dist/target/kilobase/* $out/ - - runHook postInstall - ''; + # Add pg17 feature to the build + cargoBuildFlags = [ "--package" "kilobase" "--features" "pg17" ]; # Update this array when kilobase version is updated previousVersions = [ From 6f9da3bfc3cd29e994dbdda6c1e5060174f6f196 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:06:48 -0400 Subject: [PATCH 25/37] build(nix): removing the double build. --- nix/ext/kilobase.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index c1a41d1de..10196cc83 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -28,15 +28,12 @@ buildPgrxExtension_0_15_0 rec { # Cargo.toml path if not at root cargoRoot = "apps/kbve/kilobase"; - # Override build to use cargo pgrx package command - cargoBuildFlags = [ ]; + # Build only the kilobase package with pg17 feature + cargoBuildFlags = [ "--package" "kilobase" "--features" "pg17" ]; nativeBuildInputs = [ cargo ]; buildInputs = [ postgresql ]; - # Add pg17 feature to the build - cargoBuildFlags = [ "--package" "kilobase" "--features" "pg17" ]; - # Update this array when kilobase version is updated previousVersions = [ # Add previous versions here when updating From e8eb0f73687b1d78ce5bc9fd9ffbff181f47d98b Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:45:03 -0400 Subject: [PATCH 26/37] build(nix): getting a better understanding of the error. --- nix/cargo-pgrx/versions.json | 11 +++++++++++ nix/ext/kilobase.nix | 6 ------ nix/overlays/default.nix | 12 +++++++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/nix/cargo-pgrx/versions.json b/nix/cargo-pgrx/versions.json index 2a4e24192..5ee7f923b 100644 --- a/nix/cargo-pgrx/versions.json +++ b/nix/cargo-pgrx/versions.json @@ -56,6 +56,17 @@ "cargoHash": "sha256-Ny7j56pwB+2eEK62X0nWfFKQy5fBz+Q1oyvecivxLkk=" } } + }, + "0.15.0": { + "hash": "sha256-sksRfNV6l8YbdI6fzrEtanpDVV4sh14JXLqYBydHwy0=", + "rust": { + "1.85.0": { + "cargoHash": "sha256-TODO-NEEDS-PROPER-HASH" + }, + "1.87.0": { + "cargoHash": "sha256-TODO-NEEDS-PROPER-HASH" + } + } } } diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 10196cc83..ce5304494 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -7,12 +7,6 @@ buildPgrxExtension_0_15_0, rust-bin, }: -let - rustVersion = "1.85.0"; # Updated to support edition 2024 - cargo = rust-bin.stable.${rustVersion}.default.override { - extensions = [ "rust-src" "rustfmt" "clippy" ]; - }; -in buildPgrxExtension_0_15_0 rec { pname = "kilobase"; version = "0.1.0"; diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 90e5d25f1..7d761c1e6 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -52,8 +52,14 @@ cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_14_3; }; - buildPgrxExtension_0_15_0 = prev.buildPgrxExtension.override { - cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_15_0; - }; + buildPgrxExtension_0_15_0 = + let + rustVersion = "1.85.0"; + pgrxVersion = "0.15.0"; + mkPgrxExtension = final.callPackages ../cargo-pgrx/mkPgrxExtension.nix { + inherit rustVersion pgrxVersion; + }; + in + mkPgrxExtension; }; } From ce13e5a51a25b7be31127b579e13b25f4767e3bb Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:46:04 -0400 Subject: [PATCH 27/37] build(nix): removing some of the other imports. --- nix/ext/kilobase.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index ce5304494..07f4ca8c9 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -5,7 +5,6 @@ fetchFromGitHub, postgresql, buildPgrxExtension_0_15_0, - rust-bin, }: buildPgrxExtension_0_15_0 rec { pname = "kilobase"; @@ -25,7 +24,7 @@ buildPgrxExtension_0_15_0 rec { # Build only the kilobase package with pg17 feature cargoBuildFlags = [ "--package" "kilobase" "--features" "pg17" ]; - nativeBuildInputs = [ cargo ]; + nativeBuildInputs = [ ]; buildInputs = [ postgresql ]; # Update this array when kilobase version is updated @@ -33,7 +32,6 @@ buildPgrxExtension_0_15_0 rec { # Add previous versions here when updating ]; - CARGO = "${cargo}/bin/cargo"; # Darwin env needs PGPORT to be unique for build to not clash with other pgrx extensions env = lib.optionalAttrs stdenv.isDarwin { From 892d9576b7d7aed9bb2aaa4cfa95d405a3922082 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:46:54 -0400 Subject: [PATCH 28/37] build(nix): adjusting the version issue. --- nix/cargo-pgrx/versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/cargo-pgrx/versions.json b/nix/cargo-pgrx/versions.json index 5ee7f923b..20634ebb1 100644 --- a/nix/cargo-pgrx/versions.json +++ b/nix/cargo-pgrx/versions.json @@ -61,7 +61,7 @@ "hash": "sha256-sksRfNV6l8YbdI6fzrEtanpDVV4sh14JXLqYBydHwy0=", "rust": { "1.85.0": { - "cargoHash": "sha256-TODO-NEEDS-PROPER-HASH" + "cargoHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" }, "1.87.0": { "cargoHash": "sha256-TODO-NEEDS-PROPER-HASH" From f5d386ed78ebda87fed95a0773974cc8aadcb0e0 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:48:02 -0400 Subject: [PATCH 29/37] build(nix): updating the versions json. --- nix/cargo-pgrx/versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/cargo-pgrx/versions.json b/nix/cargo-pgrx/versions.json index 20634ebb1..c78ba8bc2 100644 --- a/nix/cargo-pgrx/versions.json +++ b/nix/cargo-pgrx/versions.json @@ -61,7 +61,7 @@ "hash": "sha256-sksRfNV6l8YbdI6fzrEtanpDVV4sh14JXLqYBydHwy0=", "rust": { "1.85.0": { - "cargoHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + "cargoHash": "sha256-4a7jz8+/HeOmEEWRadbFzEhAoYEd8Oj30vso5KYnDbs=" }, "1.87.0": { "cargoHash": "sha256-TODO-NEEDS-PROPER-HASH" From 214e7a46695fbfa7c6945f25656bb2d63fcddfe7 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:00:50 -0400 Subject: [PATCH 30/37] build(nix): maybe we could resolve the Cargo lock issue. --- nix/ext/kilobase.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 07f4ca8c9..21a230dbf 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -49,9 +49,11 @@ buildPgrxExtension_0_15_0 rec { allowBuiltinFetchGit = true; }; - # Override the default Cargo.toml generation to use our filtered workspace + # Copy the workspace Cargo.lock to the kilobase subdirectory where cargo expects it postPatch = '' - # Make sure we're using our filtered workspace configuration + cp ${src}/Cargo.lock apps/kbve/kilobase/Cargo.lock + + # Debug: Make sure we're using our filtered workspace configuration ls -la Cargo.toml cat Cargo.toml ''; From 0e7413948e1369911797648e9b27fbc94e5a5365 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:03:08 -0400 Subject: [PATCH 31/37] build(nix): trying to build from the root workspace. --- nix/ext/kilobase.nix | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 21a230dbf..a22568b6b 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -18,11 +18,11 @@ buildPgrxExtension_0_15_0 rec { hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; }; - # Cargo.toml path if not at root - cargoRoot = "apps/kbve/kilobase"; + # Build from workspace root + cargoRoot = "."; # Build only the kilobase package with pg17 feature - cargoBuildFlags = [ "--package" "kilobase" "--features" "pg17" ]; + cargoBuildFlags = [ "--package" "kilobase" ]; nativeBuildInputs = [ ]; buildInputs = [ postgresql ]; @@ -49,14 +49,8 @@ buildPgrxExtension_0_15_0 rec { allowBuiltinFetchGit = true; }; - # Copy the workspace Cargo.lock to the kilobase subdirectory where cargo expects it - postPatch = '' - cp ${src}/Cargo.lock apps/kbve/kilobase/Cargo.lock - - # Debug: Make sure we're using our filtered workspace configuration - ls -la Cargo.toml - cat Cargo.toml - ''; + # Add pg17 feature + buildFeatures = [ "pg17" ]; # Disable tests for now doCheck = false; From 5bcbf35c69a9f0a244594aa8cff30979853eba9a Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:04:28 -0400 Subject: [PATCH 32/37] build(nix): adjustments to the root package. --- nix/ext/kilobase.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index a22568b6b..1460a1b5c 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -51,6 +51,27 @@ buildPgrxExtension_0_15_0 rec { # Add pg17 feature buildFeatures = [ "pg17" ]; + + # Override buildPhase to properly handle workspace package + buildPhase = '' + runHook preBuild + + echo "Building kilobase from workspace root" + + # First build the package + PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES --package kilobase" \ + cargo build --release --package kilobase --features pg17 + + # Then package it with pgrx + cd apps/kbve/kilobase + cargo pgrx package \ + --pg-config ${postgresql}/bin/pg_config \ + --release \ + --features "pg17" \ + --out-dir "$out" + + runHook postBuild + ''; # Disable tests for now doCheck = false; From a345ff0f2d3d06b63b6f7a143db76b1c3ddf0fc3 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:05:26 -0400 Subject: [PATCH 33/37] build(nix): updating the kilobase build. --- nix/ext/kilobase.nix | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 1460a1b5c..25beae5f8 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -52,26 +52,8 @@ buildPgrxExtension_0_15_0 rec { # Add pg17 feature buildFeatures = [ "pg17" ]; - # Override buildPhase to properly handle workspace package - buildPhase = '' - runHook preBuild - - echo "Building kilobase from workspace root" - - # First build the package - PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES --package kilobase" \ - cargo build --release --package kilobase --features pg17 - - # Then package it with pgrx - cd apps/kbve/kilobase - cargo pgrx package \ - --pg-config ${postgresql}/bin/pg_config \ - --release \ - --features "pg17" \ - --out-dir "$out" - - runHook postBuild - ''; + # Since we're at workspace root, we need to specify where to enter for build + buildAndTestSubdir = "apps/kbve/kilobase"; # Disable tests for now doCheck = false; From 0d9ce6855a62123832feef0fa8a1b817ca60c32e Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:08:24 -0400 Subject: [PATCH 34/37] build(nix): another attempt. --- nix/ext/kilobase.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 25beae5f8..5b08d76db 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -18,10 +18,10 @@ buildPgrxExtension_0_15_0 rec { hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; }; - # Build from workspace root + # Build from workspace root to handle Cargo.lock properly cargoRoot = "."; - # Build only the kilobase package with pg17 feature + # Build only the kilobase package cargoBuildFlags = [ "--package" "kilobase" ]; nativeBuildInputs = [ ]; @@ -32,7 +32,6 @@ buildPgrxExtension_0_15_0 rec { # Add previous versions here when updating ]; - # Darwin env needs PGPORT to be unique for build to not clash with other pgrx extensions env = lib.optionalAttrs stdenv.isDarwin { POSTGRES_LIB = "${postgresql}/lib"; @@ -51,12 +50,12 @@ buildPgrxExtension_0_15_0 rec { # Add pg17 feature buildFeatures = [ "pg17" ]; - - # Since we're at workspace root, we need to specify where to enter for build - buildAndTestSubdir = "apps/kbve/kilobase"; # Disable tests for now doCheck = false; + + # Disable cargo-auditable to avoid issues with edition 2024 + auditable = false; meta = with lib; { description = "Kilobase PostgreSQL extension"; From ee0395d623acf58de569f1ef2e15fb26b1966bdd Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:09:38 -0400 Subject: [PATCH 35/37] build(nix): adding a patch. --- nix/ext/kilobase.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index 5b08d76db..cf723e77b 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -18,11 +18,11 @@ buildPgrxExtension_0_15_0 rec { hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; }; - # Build from workspace root to handle Cargo.lock properly - cargoRoot = "."; + # Build from the kilobase subdirectory + cargoRoot = "apps/kbve/kilobase"; - # Build only the kilobase package - cargoBuildFlags = [ "--package" "kilobase" ]; + # No need for --package flag when in the package directory + cargoBuildFlags = [ ]; nativeBuildInputs = [ ]; buildInputs = [ postgresql ]; @@ -56,6 +56,11 @@ buildPgrxExtension_0_15_0 rec { # Disable cargo-auditable to avoid issues with edition 2024 auditable = false; + + # Copy Cargo.lock to the subdirectory where cargo expects it + postPatch = '' + cp ${src}/Cargo.lock apps/kbve/kilobase/ + ''; meta = with lib; { description = "Kilobase PostgreSQL extension"; From 14d711f84c54d4b84ee20d7253c73b4cbfe32d16 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:11:42 -0400 Subject: [PATCH 36/37] build(nix): reverting the workspace. --- nix/ext/kilobase.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index cf723e77b..acef27383 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -18,11 +18,11 @@ buildPgrxExtension_0_15_0 rec { hash = "sha256-VVH9GyKgKgkvi3iI8SffScPl00cIDlvPZbVJLgrzX1o="; }; - # Build from the kilobase subdirectory - cargoRoot = "apps/kbve/kilobase"; + # Build from workspace root (with Rust 1.85 we support edition 2024) + cargoRoot = "."; - # No need for --package flag when in the package directory - cargoBuildFlags = [ ]; + # Build only kilobase package + cargoBuildFlags = [ "--package" "kilobase" ]; nativeBuildInputs = [ ]; buildInputs = [ postgresql ]; @@ -54,13 +54,11 @@ buildPgrxExtension_0_15_0 rec { # Disable tests for now doCheck = false; - # Disable cargo-auditable to avoid issues with edition 2024 + # Disable cargo-auditable to avoid issues auditable = false; - # Copy Cargo.lock to the subdirectory where cargo expects it - postPatch = '' - cp ${src}/Cargo.lock apps/kbve/kilobase/ - ''; + # Tell cargo pgrx package which package to build + buildAndTestSubdir = "apps/kbve/kilobase"; meta = with lib; { description = "Kilobase PostgreSQL extension"; From bd520f2818d976366d1f270637e41e8a22746525 Mon Sep 17 00:00:00 2001 From: h0lybyte <5599058+h0lybyte@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:16:59 -0400 Subject: [PATCH 37/37] build(nix): updating the kilobase double flag issue. --- nix/ext/kilobase.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/ext/kilobase.nix b/nix/ext/kilobase.nix index acef27383..b61450f3a 100644 --- a/nix/ext/kilobase.nix +++ b/nix/ext/kilobase.nix @@ -21,8 +21,8 @@ buildPgrxExtension_0_15_0 rec { # Build from workspace root (with Rust 1.85 we support edition 2024) cargoRoot = "."; - # Build only kilobase package - cargoBuildFlags = [ "--package" "kilobase" ]; + # Build only kilobase package - but don't use --package flag as buildAndTestSubdir handles it + cargoBuildFlags = [ ]; nativeBuildInputs = [ ]; buildInputs = [ postgresql ];