nixpkgs/pkgs/games/quake3/wrapper/default.nix
Sergei Trofimovich 06afa6115d quake3demo: fix binary paths in the wrapper
https://github.com/NixOS/nixpkgs/pull/209008 moved quake3 binaries to
$out/bin. This broke wrappers as:

    $ NIXPKGS_ALLOW_UNFREE=1 nix build -f. quake3demo -L
    ...
    quake3-demo> Builder called die: Cannot wrap '/nix/store/khlq2wa0i7rab4vkzvk4pl54lyi6c36d-quake3-demo-1.11-6-ioquake3-unstable-2022-11-24/bin/quake3' because it is not an executable file

The change fixes wrapper to point to new locations.
2023-02-24 19:19:21 +00:00

34 lines
910 B
Nix

{ stdenv, buildEnv, lib, libGL, ioquake3, makeWrapper }:
{ paks, name ? (lib.head paks).name, description ? "" }:
let
libPath = lib.makeLibraryPath [ libGL stdenv.cc.cc ];
env = buildEnv {
name = "quake3-env";
paths = [ ioquake3 ] ++ paks;
};
in stdenv.mkDerivation {
name = "${name}-${ioquake3.name}";
nativeBuildInputs = [ makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
# We add Mesa to the end of $LD_LIBRARY_PATH to provide fallback
# software rendering. GCC is needed so that libgcc_s.so can be found
# when Mesa is used.
makeWrapper ${env}/bin/ioquake3.* $out/bin/quake3 \
--suffix-each LD_LIBRARY_PATH ':' "${libPath}" \
--add-flags "+set fs_basepath ${env} +set r_allowSoftwareGL 1"
makeWrapper ${env}/bin/ioq3ded.* $out/bin/quake3-server \
--add-flags "+set fs_basepath ${env}"
'';
meta = {
inherit description;
};
}