axodotdev / oranda

🎁 generate beautiful landing pages for your developer tools

Home Page:https://opensource.axo.dev/oranda/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when installed with `cargo binstall`, Oranda 0.3.1 doesn't run on NixOS 23.11

hawkw opened this issue · comments

When Oranda 0.3.1 is installed using cargo binstall, executing the resultant binary on NixOS 23.11 fails with a "no such file or directory" error:

eliza@noctis:~ $ oranda
The program 'oranda' is currently not installed. It is provided by
several packages. You can install it by typing one of the following:
  nix-env -iA nixpkgs.

Or run it once with:
  nix-shell -p  --run ...

eliza@noctis:~ $ which oranda
/home/eliza/.cargo/bin/oranda

eliza@noctis:~ $ /home/eliza/.cargo/bin/oranda
zsh: no such file or directory: /home/eliza/.cargo/bin/oranda

eliza@noctis:~ $ cd /home/eliza/.cargo/bin

eliza@noctis:~/.cargo/bin $ ./oranda
zsh: no such file or directory: ./oranda

Running ls indicates that ~/.cargo/bin/oranda definitely exists:

eliza@noctis:~ $ ls -la /home/eliza/.cargo/bin/oranda
.rwxr-xr-x eliza users 31 MB Fri Aug 18 07:34:21 2023  /home/eliza/.cargo/bin/oranda

file indicates that the file is executable:

eliza@noctis:~ $ file /home/eliza/.cargo/bin/oranda
/home/eliza/.cargo/bin/oranda: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a78a8a125a574bf684246d8b82a045c671535724, for GNU/Linux 3.2.0, with debug_info, not stripped

Info about my environment:

eliza@noctis:~ $ uname -a
Linux noctis 6.1.45 #1-NixOS SMP PREEMPT_DYNAMIC Fri Aug 11 10:08:27 UTC 2023 x86_64 GNU/Linux

eliza@noctis:~ $ cargo binstall -V
1.2.1

Oh, I think I know what the issue is: file says that the interpreter path is:

interpreter /lib64/ld-linux-x86-64.so.2

but for locally-built executables, the interpreter path is to the ld in the Nix store:

eliza@noctis:~ $ file /home/eliza/.cargo/bin/cargo-binstall
/home/eliza/.cargo/bin/cargo-binstall: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib/ld-linux-x86-64.so.2, for GNU/Linux 3.10.0, with debug_info, not stripped

note that the interpreter path is:

interpreter /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib/ld-linux-x86-64.so.2

So, this seems more like "cargo binstall doesn't work on NixOS", rather than an Oranda issue.

Just confirming: indeed "prebuilt binaries for linux" as a concept doesn't work for nixos, because nixos intentionally obfuscates the paths to core system binaries needed to run any binary. This lets them require everything on your system to be integrated into the nix package manager and play ball with the dependency system to run at all. In other words nix flakes (or i guess cargo install to build from source?) are the only valid ways to install a binary on nixos, aiui.

Just confirming: indeed "prebuilt binaries for linux" as a concept doesn't work for nixos, because nixos intentionally obfuscates the paths to core system binaries needed to run any binary. This lets them require everything on your system to be integrated into the nix package manager and play ball with the dependency system to run at all. In other words nix flakes (or i guess cargo install to build from source?) are the only valid ways to install a binary on nixos, aiui.

Yeah, unfortunately the flake for Oranda is still on v0.2.x, and cargo install oranda fails on my machine --- so, I figured I'd try one last thing. There is a gross hack (https://github.com/Mic92/nix-ld) I may end up trying...

Ah, I gather you ran into #603 when running cargo install?

Yup, that's the issue with cargo install, thanks for the reference. The flake also doesn't work for me --- I can open a new issue for that, since AFAICT it doesn't seem to be tracked yet. Based on the error, it looks like there's a hardcoded directory path in the build script or something; I'm happy to investigate further:

eliza@noctis:~ $ nix profile install github:axodotdev/oranda
error: builder for '/nix/store/kx5pnfs0sv1dkpdraca7x2ra0ik2r5mn-oranda-0.3.1.drv' failed with exit code 101;
       last 10 log lines:
       >    Compiling tower-http v0.3.5
       >    Compiling include_dir v0.7.3
       > error: failed to run custom build command for `oranda v0.3.1 (/build/p4xidd5wis4l54kwihd0xlsl2wndrzp5-source)`
       >
       > Caused by:
       >   process didn't exit successfully: `/build/p4xidd5wis4l54kwihd0xlsl2wndrzp5-source/target/release/build/oranda-8912216293ac71d8/build-script-build` (exit status: 101)
       >   --- stderr
       >   thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: AxoAsset(LocalAssetDirCreationFailed { dest_path: "/homeless-shelter/.cache/oranda", details: Os { code: 13, kind: PermissionDenied, message: "Permission denied" } })', build.rs:13:67
       >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       > warning: build failed, waiting for other jobs to finish...
       For full logs, run 'nix log /nix/store/kx5pnfs0sv1dkpdraca7x2ra0ik2r5mn-oranda-0.3.1.drv'.

That would be great! The nix flake isn't first-party maintained, someone else contributed it experimentally (and evidently the experiment hasn't been kept up to date).

Ah, looks like the build.rs tries to download a prebuilt tailwind binary, which also won't work...maybe the flake can depend on tailwind from nixpkgs?

That sounds perfect, yeah.

#609 should fix the Nix flake!