How do I invoke a binary inside a buildFHSUserEnv?

I’m trying to wrap using a buildFHSUserEnv in a slightly more “comfortable” way, by providing a wrapper script that effectively drops into the user env and then runs a provided binary.

I’ve done this in the worst-possible way by just piping things into the bash prompt returned by nix-shell: javaws-env.nix · GitHub, but I’m pretty sure there’s a better way of doing this. nix-shell --command nor nix-shell --run actually seem to do anything when presented with the .env output of buildFHSUserEnv.

This is because I want to be able to run javaws from adoptopenjdk-icedtea-web, but I need things to be in a reasonable place because the JNLP I’m invoking runs an applet which drops a Linux binary which is expecting a standard FHS layout…

1 Like

I figured it out, and it was less horrible that I was making it!

https://phab.lukegb.com/rDa3dc40361576733e182a6a0d1951ae8dc8353a5b

I basically just ended up using a wrapper script.

you can also take a look at steam-run as that does exactly what you’re describing

2 Likes

the link is dead and doesn’t seem to exist on the new site? I thought perhaps this comes close NixOS on Xen PV... debootstrap style | Luke Granger-Brown but it doesn’t seem to mention FHS