mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
gemini-cli: fix file collisions
Multiple Node.js packages in nixpkgs create file collisions when installed together in home-manager or system profiles. Specifically:
- `gemini-cli` vs `eslint`: collision on `lib/node_modules/eslint/conf/default-cli-options.js`
- `gemini-cli` vs `angular-language-server`: collision on `lib/node_modules/semver/README.md` (with permission differences: 0555 vs 0444)
This occurs because these packages install their bundled dependencies directly to `$out/lib/node_modules/`, causing path conflicts when multiple packages provide the same transitive dependencies.
The issue stems from packages copying their entire `node_modules` directory to a shared location (`$out/lib/node_modules/`) rather than isolating their dependencies in package-specific directories.
Before:
```nix
cp -r node_modules "$out/lib/"
```
After:
```nix
cp -r node_modules "$out/share/gemini-cli/"
```
This is probably counterproductive in some ways (would ideally share deps?) but at least this fix allows these packages to coexist.
(cherry picked from commit 1aff5d6e7e)
This commit is contained in:
committed by
github-actions[bot]
parent
5babfe78c0
commit
f75695404d
@@ -36,20 +36,16 @@ buildNpmPackage (finalAttrs: {
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/{bin,share/gemini-cli}
|
||||
|
||||
mkdir -p "$out/lib"
|
||||
cp -r node_modules $out/share/gemini-cli/
|
||||
|
||||
cp -r node_modules "$out/lib/"
|
||||
|
||||
rm -f "$out/lib/node_modules/@google/gemini-cli"
|
||||
rm -f "$out/lib/node_modules/@google/gemini-cli-core"
|
||||
|
||||
cp -r packages/cli "$out/lib/node_modules/@google/gemini-cli"
|
||||
cp -r packages/core "$out/lib/node_modules/@google/gemini-cli-core"
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
ln -s ../lib/node_modules/@google/gemini-cli/dist/index.js "$out/bin/gemini"
|
||||
rm -f $out/share/gemini-cli/node_modules/@google/gemini-cli
|
||||
rm -f $out/share/gemini-cli/node_modules/@google/gemini-cli-core
|
||||
cp -r packages/cli $out/share/gemini-cli/node_modules/@google/gemini-cli
|
||||
cp -r packages/core $out/share/gemini-cli/node_modules/@google/gemini-cli-core
|
||||
|
||||
ln -s $out/share/gemini-cli/node_modules/@google/gemini-cli/dist/index.js $out/bin/gemini
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user