Skip to content

Commit cefa25b

Browse files
hxrtsPacman99
authored andcommitted
Fix PR review comments
- docs/guides/solana-development.md: Use overrideAttrs instead of override to properly extend shell configuration without breaking zero.nix environment setup - packages/solana-tools.nix: Improve idl command detection to match whole words only, preventing false positives with substrings like 'my-idl-program'
1 parent 20383be commit cefa25b

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

docs/guides/solana-development.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ These environment variables ensure that:
202202

203203
### Custom Configuration
204204

205-
Override environment variables in your `flake.nix`:
205+
Extend the development environment in your `flake.nix`:
206206

207207
```nix
208208
{
@@ -211,15 +211,15 @@ Override environment variables in your `flake.nix`:
211211
inherit self;
212212
src = ./.;
213213
214-
devShells.default = zero-nix.devShells.default.override {
215-
shellHook = ''
214+
devShells.default = zero-nix.devShells.default.overrideAttrs (oldAttrs: {
215+
shellHook = (oldAttrs.shellHook or "") + ''
216216
# Custom solana configuration
217217
solana config set --url https://api.mainnet-beta.solana.com
218218
219219
# Project-specific setup
220220
echo "My Solana project initialized"
221221
'';
222-
};
222+
});
223223
};
224224
}
225225
```
@@ -245,12 +245,12 @@ Add zero.nix to your `flake.nix`:
245245
};
246246
247247
outputs = { self, zero-nix }: {
248-
devShells.default = zero-nix.devShells.default.override {
249-
buildInputs = with zero-nix.legacyPackages.${system}; [
248+
devShells.default = zero-nix.devShells.default.overrideAttrs (oldAttrs: {
249+
buildInputs = (oldAttrs.buildInputs or []) ++ (with zero-nix.legacyPackages.${system}; [
250250
solana-tools
251251
# Add your existing tools here
252-
];
253-
};
252+
]);
253+
});
254254
};
255255
}
256256
```

packages/solana-tools.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,13 @@ EOF
329329
mkdir -p "$CARGO_HOME" "$RUSTUP_HOME"
330330
331331
# Check if this is for IDL generation and use nightly rust
332-
if [[ "$*" == *"idl"* ]]; then
333-
export PATH="${nightly-rust}/bin:${solana-node}/bin:$PATH"
334-
export RUSTC="${nightly-rust}/bin/rustc"
335-
export CARGO="${nightly-rust}/bin/cargo"
336-
fi
332+
case " $@ " in
333+
*" idl "*)
334+
export PATH="${nightly-rust}/bin:${solana-node}/bin:$PATH"
335+
export RUSTC="${nightly-rust}/bin/rustc"
336+
export CARGO="${nightly-rust}/bin/cargo"
337+
;;
338+
esac
337339
338340
# Run anchor with platform tools environment
339341
exec "${anchor}/bin/anchor" "$@"

0 commit comments

Comments
 (0)