You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.0 KiB
Nix

{
stdenv, pkgs, requireFile, makeWrapper,
libX11, libXext, libXcursor, libXrandr,
alsaLib, mesa_glu, libudev, unzip, mods, ...
}:
let
fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; };
buildNumber = "1722";
in
stdenv.mkDerivation rec {
name = "rimworld-${version}";
version = "alpha-18";
MODLIST = mods;
src = fetchfile {
path = ../../../nixrc-src-games/RimWorldBeta18Linux.zip;
storeHash = "gxff7zx0dwfr2gbj8y3wqn1by8a22dmz";
};
phases = "unpackPhase installPhase";
unpackCmd = "${unzip}/bin/unzip -qq $src || true";
libPath = stdenv.lib.makeLibraryPath [
alsaLib
mesa_glu
libX11
libXext
libXcursor
libXrandr
libudev
stdenv.cc.cc.lib
];
buildInputs = [
makeWrapper
];
installPhase = ''
mkdir -p $out
mv * $out/
chmod +x $out/start_RimWorld.sh
chmod +x $out/start_RimWorld_openglfix.sh
chmod +x $out/RimWorld${buildNumber}Linux.x86_64
chmod +x $out/RimWorld${buildNumber}Linux.x86
for modPath in $MODLIST
do
echo "Installing mod from $modPath..."
${unzip}/bin/unzip "$modPath" -d "$out/Mods/"
done
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/RimWorld${buildNumber}Linux.x86_64
#wrapProgram $out/RimWorld${buildNumber}Linux.x86_64 \
# --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
mkdir -p $out/bin
makeWrapper $out/RimWorld${buildNumber}Linux.x86_64 $out/bin/rimworld \
--add-flags -logfile \
--add-flags /tmp/rimworld_log \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
patchShebangs $out/start_RimWorld.sh
patchShebangs $out/start_RimWorld_openglfix.sh
'';
}