Consider this shell.nix
file:
let
nixpkgsGitCommit = "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5";
nixpkgsTarball = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsGitCommit}.tar.gz";
sha256 = "1sfb9g6fmyfligcsd1rmkamfqvy8kgn3p0sy8ickf6swi1zdbf0b";
};
pkgs = import nixpkgsTarball { };
in pkgs.mkShellNoCC {
name = "shell-for-testing-godot-export-templates";
shellHook = ''
cd /var/empty
echo Running Godot 3 export template…
${pkgs.lib.strings.escapeShellArg "${pkgs.godot3-export-templates}/share/godot/templates/3.6.stable/linux_x11_64_release"}
echo "Done. Exit status: $?"
echo Running Godot 4 export template…
${pkgs.lib.strings.escapeShellArg "${pkgs.godot_4-export-templates}/linux_release.x86_64"}
exec echo "Done. Exit status: $?"
'';
}
When I run nix-shell
with that shell.nix
file, here’s what happens:
$ nix-shell
Running Godot 3 export template…
Error: Couldn't load project data at path ".". Is the .pck file missing?
If you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).
Done. Exit status: 255
Running Godot 4 export template…
Could not start dynamically linked executable: /nix/store/c2zaa7r7db2a0afdq5jdrn8hrqxcdk76-godot-export-templates-4.4-stable/linux_release.x86_64
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
Done. Exit status: 127
$
The first error is exactly what I would expect. Godot export templates aren’t supposed to work if you don’t give them a Godot project to run. The second error was surprising to me. If the godot3-export-templates
package provide binaries that can be run on NixOS (without a workaround like nix-ld
), then I would expect that the godot_4-export-templates
package would also provide binaries that can be run on NixOS.
At the moment, I’m working on creating a Nix package for one of my Godot games. I thought that I would be able to use one of the executables from the godot_4-export-templates
package when packaging my game, but that isn’t working because the executables can’t be run on NixOS without something like nix-ld
.
What should I do here? Are there any packages that provide NixOS-native Godot 4 export template executables?