{ stdenvNoCC, lib, requireFile, unzip, copyDesktopItems, xxd, makeWrapper, SDL2, mono, makeDesktopItem, libfmodstudio_fix, libfmodstudio, libfna3d, libfmodsdl, }: stdenvNoCC.mkDerivation rec { name = "celeste-game"; version = "1.4.0.0"; src = requireFile { name = "celeste-linux.zip"; url = "https://maddymakesgamesinc.itch.io/celeste"; hash = "sha256-q4gniSgg00U3j5TZpvIZnSmqAyCHd/pOVAuQ3rDYEAs="; }; sourceRoot = "."; # needed for multiple directories nativeBuildInputs = [ unzip # for unzipping copyDesktopItems # will help! makeWrapper xxd ]; buildInputs = [ libfmodstudio_fix libfmodstudio libfna3d SDL2 libfmodsdl mono ]; strictDeps = true; dontConfigure = true; patchPhase = '' # patch celeste runHook prePatch # TODO: i don't know what this magic string does and it bothers me # TODO: convert these to patch files? xxd -p < Celeste.exe | tr -d '\n' | LC_ALL=C sed 's/03000616fe012a0013300200210000000a000011160a02145112012014100100/03000616fe012a0013300200210000000a000011160a02145112012006020200/g' | xxd -r -p > Celeste.exe.patched mv Celeste.exe.patched Celeste.exe # this cannot possibly be the best way of doing this cat >Celeste.exe.config < EOF runHook postPatch ''; dontBuild = true; installPhase = '' runHook preInstall # these get clobbered mkdir -p $out/{bin,lib} cp Celeste.exe Celeste.exe.config Celeste.pdb $out/lib cp Celeste.Content.dll Celeste.Content.pdb $out/lib cp FNA.dll FNA.dll.config FNA3D.dll $out/lib cp -r Content/ $out/lib cp -r Backups/ $out/lib cp gamecontrollerdb.txt $out/lib mkdir -p $out/share/icons/hicolor/512x512/apps cp Celeste.png $out/share/icons/hicolor/512x512/apps runHook postInstall ''; postFixup = '' makeWrapper "${mono}/bin/mono" "$out/bin/celeste-game" \ --add-flags "--debug $out/lib/Celeste.exe" \ --prefix LD_LIBRARY_PATH : ${ lib.makeLibraryPath [ "$out" libfmodstudio_fix libfmodstudio libfna3d SDL2 libfmodsdl ] } ''; desktopItems = [ (makeDesktopItem { name = name; exec = "celeste-game %U"; icon = "Celeste"; comment = "Just breathe. You can do this..."; # should be an actual description of Celeste desktopName = "Celeste"; categories = [ "Game" "Application" ]; }) ]; meta = { }; }