fix(install): prefer the musl asset on NixOS and other non-FHS hosts
CI / editor tests (push) Successful in 1m28s

NixOS keeps glibc in the store, so a generic `-gnu` release binary cannot
find its dynamic loader. The old detection missed this twice over: `ldd
--version` reports plain GNU libc there, and `/lib64/ld-linux-x86-64.so.2`
does exist — as a stub that only prints an error and exits 127. The
installer downloaded the gnu asset, `executable()` returned 1, and the
binary could never start.

Detect non-FHS distributions (`/etc/NIXOS`, `ID=nixos`/`ID=guix` in
os-release) and pick the statically linked musl asset there. Turn the
single target triple into an ordered candidate list so glibc hosts fall
back to musl too, and verify the staged binary actually execs — exit 126
or 127 means the kernel or loader refused it — before it lands in `bin/`.

Applied to both installers (Lua and the Vim build hook, which the shell
test harnesses source). Adds `g:nuwiki_ls_target` to force a triple.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qPCSWXxATFvjEpVxQMhG9
This commit is contained in:
2026-08-07 14:58:48 -03:00
parent 5375e30bda
commit 95c054ef80
4 changed files with 185 additions and 46 deletions
+8
View File
@@ -88,6 +88,13 @@ a Rust toolchain (1.83+ stable). You can run install manually any time with
`:NuwikiInstall` (works in both Vim and Neovim) instead of relying on a
plugin-manager build hook.
On Linux the installer picks the musl (statically linked) asset when the
host is musl-based or is not an FHS distribution — NixOS and Guix System
keep glibc in the store, so a generic `-gnu` binary cannot find its dynamic
loader there. Elsewhere it prefers the `-gnu` asset and falls back to musl
if the downloaded binary turns out not to run. Set `g:nuwiki_ls_target` to
a release triple (e.g. `x86_64-unknown-linux-musl`) to force the choice.
### Requirements
- **Neovim 0.11+** — uses the built-in LSP client; no extra plugin.
@@ -462,6 +469,7 @@ For users configuring without Lua.
| `g:nuwiki_no_folding` | `0` | `1` skips foldexpr setup |
| `g:nuwiki_mouse_mappings` | `0` | `1` enables mouse maps |
| `g:nuwiki_binary_path` | _(auto)_ | path to a prebuilt `nuwiki-ls` binary, bypassing the bundled one |
| `g:nuwiki_ls_target` | _(auto)_ | force a release target triple at install time, e.g. `x86_64-unknown-linux-musl` |
| `g:nuwiki_no_calendar` | `0` | `1` opts out of calendar-vim integration |
| `g:nuwiki_auto_chdir` | `0` | `1` `:lcd` into the wiki root when a wiki buffer becomes current |
| `g:nuwiki_auto_header` | `0` | `1` insert a level-1 header from the filename on new wiki pages |