Skip to content

Commit 96788ff

Browse files
committed
build(nix): trying to isolate the kilobase plugin.
1 parent e52d8a8 commit 96788ff

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

nix/ext/kilobase.nix

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,22 @@ buildPgrxExtension_0_15_0 rec {
2626
rev = "main"; # Use main branch or specific commit hash
2727
hash = "sha256-3HLpiGuM2zl6h7hIspe9lsHlo/kLy6FaxgTaopR7H4Y=";
2828
};
29-
in pkgs.runCommand "kilobase-filtered-src" {} ''
30-
# Copy the full source
31-
cp -r ${fullSrc} $out
29+
in pkgs.runCommand "kilobase-isolated-src" {
30+
nativeBuildInputs = [ cargo ];
31+
CARGO = "${cargo}/bin/cargo";
32+
} ''
33+
# Copy only the kilobase directory and necessary files
34+
mkdir -p $out/apps/kbve
35+
cp -r ${fullSrc}/apps/kbve/kilobase $out/apps/kbve/
36+
37+
# Copy any shared files that might be needed (like .gitignore, etc.)
38+
if [ -f ${fullSrc}/.gitignore ]; then
39+
cp ${fullSrc}/.gitignore $out/
40+
fi
41+
3242
chmod -R +w $out
3343
34-
# Create a minimal workspace Cargo.toml that only includes kilobase
44+
# Create a standalone workspace Cargo.toml that only includes kilobase
3545
cat > $out/Cargo.toml << 'EOF'
3646
[workspace]
3747
resolver = "2"
@@ -48,18 +58,18 @@ lto = "fat"
4858
codegen-units = 1
4959
EOF
5060
51-
# Remove problematic workspace members to prevent cargo from trying to process them
52-
rm -rf $out/packages/rust/jedi || true
53-
rm -rf $out/packages/rust/q || true
54-
rm -rf $out/packages/rust/soul || true
55-
rm -rf $out/packages/erust || true
56-
rm -rf $out/packages/holy || true
57-
rm -rf $out/apps/kbve/rust_kanban || true
58-
rm -rf $out/apps/kbve/rust_api_profile || true
59-
rm -rf $out/apps/rareicon || true
60-
rm -rf $out/apps/experimental || true
61-
rm -rf $out/apps/rentearth || true
62-
rm -rf $out/apps/discord || true
61+
# Change to workspace root and generate a new Cargo.lock with only kilobase dependencies
62+
cd $out
63+
${cargo}/bin/cargo generate-lockfile --offline || ${cargo}/bin/cargo generate-lockfile
64+
65+
# Verify the lockfile was created
66+
if [ ! -f Cargo.lock ]; then
67+
echo "Failed to generate Cargo.lock"
68+
exit 1
69+
fi
70+
71+
echo "Generated isolated Cargo.lock for kilobase"
72+
ls -la
6373
'';
6474

6575
# Cargo.toml path if not at root
@@ -100,6 +110,13 @@ EOF
100110
# };
101111
};
102112

113+
# Override the default Cargo.toml generation to use our filtered workspace
114+
postPatch = ''
115+
# Make sure we're using our filtered workspace configuration
116+
ls -la Cargo.toml
117+
cat Cargo.toml
118+
'';
119+
103120
# Disable tests for now
104121
doCheck = false;
105122

0 commit comments

Comments
 (0)