fix: add Gentoo fd fallback

This commit is contained in:
sailor 2026-06-03 23:32:14 +01:00
parent 8fe6f6d02f
commit 472a35cc13
2 changed files with 30 additions and 2 deletions

View file

@ -59,7 +59,7 @@ sh ~/nvim-config/bootstrap.sh
```bash ```bash
sudo mkdir -p /etc/portage/package.use sudo mkdir -p /etc/portage/package.use
printf '%s\n' 'net-libs/nodejs npm' | sudo tee /etc/portage/package.use/nvim-config-nodejs printf '%s\n' 'net-libs/nodejs npm' | sudo tee /etc/portage/package.use/nvim-config-nodejs
sudo emerge --ask dev-vcs/git app-editors/neovim net-libs/nodejs sys-apps/ripgrep sys-apps/fd sudo emerge --ask dev-vcs/git app-editors/neovim net-libs/nodejs sys-apps/ripgrep
``` ```
Then run: Then run:
@ -68,6 +68,8 @@ Then run:
sh ~/nvim-config/bootstrap.sh sh ~/nvim-config/bootstrap.sh
``` ```
If `sys-apps/fd` is unavailable or its distfile is broken, the bootstrap script will try `cargo install fd-find` and place `fd` in `/usr/local/bin`.
## Notes ## Notes
- First run downloads plugins through `lazy.nvim`. - First run downloads plugins through `lazy.nvim`.
@ -75,3 +77,4 @@ sh ~/nvim-config/bootstrap.sh
- Out of the box it covers C, C++, Rust, Bash, Lua, JSON, YAML, Markdown, JavaScript, TypeScript, and GLSL. - Out of the box it covers C, C++, Rust, Bash, Lua, JSON, YAML, Markdown, JavaScript, TypeScript, and GLSL.
- Shader extensions like `.vert`, `.frag`, `.comp`, `.geom`, `.rgen`, `.rchit`, `.rmiss`, `.rint`, and `.rcall` are treated as GLSL. - Shader extensions like `.vert`, `.frag`, `.comp`, `.geom`, `.rgen`, `.rchit`, `.rmiss`, `.rint`, and `.rcall` are treated as GLSL.
- `nodejs`/`npm` are required so Mason can install the JS/TS/YAML/JSON tooling. - `nodejs`/`npm` are required so Mason can install the JS/TS/YAML/JSON tooling.
- On Gentoo, `fd` is installed by Portage if possible; otherwise the bootstrap script falls back to `cargo install fd-find`.

View file

@ -4,6 +4,30 @@ set -eu
repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
install_fd() {
if command -v fd >/dev/null 2>&1; then
return
fi
if command -v emerge >/dev/null 2>&1; then
if sudo emerge --ask sys-apps/fd; then
return
fi
echo 'Gentoo fd package failed; trying cargo fallback.' >&2
fi
if command -v cargo >/dev/null 2>&1; then
tmpdir=$(mktemp -d)
cargo install --locked --root "$tmpdir" fd-find
sudo mkdir -p /usr/local/bin
sudo install -m 755 "$tmpdir/bin/fd" /usr/local/bin/fd
rm -rf "$tmpdir"
return
fi
echo 'fd not installed; install sys-apps/fd or cargo manually.' >&2
}
install_deps() { install_deps() {
if command -v apt-get >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update sudo apt-get update
@ -19,7 +43,8 @@ install_deps() {
if command -v emerge >/dev/null 2>&1; then if command -v emerge >/dev/null 2>&1; then
sudo mkdir -p /etc/portage/package.use sudo mkdir -p /etc/portage/package.use
printf '%s\n' 'net-libs/nodejs npm' | sudo tee /etc/portage/package.use/nvim-config-nodejs >/dev/null printf '%s\n' 'net-libs/nodejs npm' | sudo tee /etc/portage/package.use/nvim-config-nodejs >/dev/null
sudo emerge --ask dev-vcs/git app-editors/neovim net-libs/nodejs sys-apps/ripgrep sys-apps/fd sudo emerge --ask dev-vcs/git app-editors/neovim net-libs/nodejs sys-apps/ripgrep
install_fd
return return
fi fi