SMAPI does not work on nixos

I am trying to run SMAPI, which is a modding tool for stardew valley. Whenever I run it, keep giving me the error install on Linux.sh: line 4: internal/linux/SMAPI.Installer: cannot execute: required file not found.
For instance, running this in the ubuntu vm works fine.

Edit: with ldd I found the issue. but have no idea how to solve it

	linux-vdso.so.1 (0x00007ffe38716000)
	libpthread.so.0 => /nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/libpthread.so.0 (0x00007efe12899000)
	libdl.so.2 => /nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/libdl.so.2 (0x00007efe12894000)
	libstdc++.so.6 => not found
	libm.so.6 => /nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/libm.so.6 (0x00007efe12520000)
	libgcc_s.so.1 => /nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/libgcc_s.so.1 (0x00007efe1287a000)
	libc.so.6 => /nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib/libc.so.6 (0x00007efe12200000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/yzjgl0h6a3qh1mby405428f16xww37h0-glibc-2.35-224/lib64/ld-linux-x86-64.so.2 (0x00007efe128a0000)

Running generic linux executables generally does not work on nixos. This is because the ELF interpreter (ld-linux.so) is not in the standard location in /lib (there isn’t even a /lib on nixos!), because script interpreters aren’t found at their usual locations aside from /bin/sh and /usr/bin/env, and because there is no global library path on nixos at all.

The possible solutions include, in rough order of preference:

  • Package whatever program it is from source, if possible
  • Package whatever program it is with autoPatchelfHook
  • Package whatever program it is with buildFHSUserEnv
  • Run it with steam-run
  • Run it with nix-ld and/or envfs

My kids and I have logged too many hours on Stardew Valley. Recently we decided it was time to download some mods. I downloaded SMAPI, extracted it, then just used steam-run to execute the installer and everything worked flawlessly.

Thank you for the solution, I’ll try it once I get back.

Also, is gamescope (the compositor from steamos) installed automatically with steam or do I need to install it separately?

Would you mind providing the command you used to do this? I am having the same issue, but I can’t figure out steam-run to be able to do it.

Took a look at my ~/.bash_history and this is what I see:

cd SMAPI\ 3.18.2\ installer/
./install\ on\ Linux.sh

You should be able to run that command from anywhere that you have downloaded the SMAPI installer to.

Let me know if it works or not.

steam-run should be in your path if you have enabled the steam module in your configuration.nix

  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
    dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
  };

then just run steam-run ./install\ on\ Linux.sh.