fangame-flake/games/uranium.nix

72 lines
1.9 KiB
Nix

{ lib
, fetchFromMega
, fetchurl
, mkWindowsApp
, wine
, wineArch
, unzip
, makeDesktopItem
, makeDesktopIcon
, copyDesktopItems
, copyDesktopIcons
}:
let uid = "pkmn-uranium";
in mkWindowsApp rec {
pname = "Pokemon Uranium";
version = "1.2.5";
meta.homepage = "https://pokemonuranium.co/";
meta.description = "Welcome to Tandor region, where an explosion in a nuclear power plant causes a lot of devastation.";
dontUnpack = true;
src = fetchFromMega rec {
name = "Pokemon Uranium ${version}.zip";
url = "https://mega.nz/file/gh82ST6S#makZr_hsZAcMOIKSEPUwejVJ_N4OW7Mk9wEBlWIoIG0";
hash = "sha256-AESWN70qOvbucuGzY8g5HT5aJSZi8FPV2qyPEpK9m5s=";
assert_exists = [ name ];
};
inherit wine wineArch;
nativeBuildInputs = [ copyDesktopItems copyDesktopIcons ];
installPhase = ''
runHook preInstall
ln -s $out/bin/.launcher $out/bin/${lib.escapeShellArg pname}
runHook postInstall
'';
winAppInstall = ''
#winetricks -q directplay directmusic dsound devenum dmsynth quartz #d3dx9_36
${unzip}/bin/unzip ${src} -d "$WINEPREFIX/drive_c"
mv -v "$WINEPREFIX/drive_c/Pokemon Uranium ${version}" "$WINEPREFIX/drive_c/${uid}"
mkdir -vp "$WINEPREFIX/drive_c/windows/fonts"
cp -v "$WINEPREFIX/drive_c/${uid}/Fonts/"* "$WINEPREFIX/drive_c/windows/fonts/"
'';
fileMap."$HOME/.local/share/${uid}/Saved Games"
= "drive_c/users/$USER/Saved Games";
winAppRun = ''
$WINE start /unix "$WINEPREFIX"/drive_c/${uid}/Uranium.exe "$ARGS"
'';
desktopItems = [
(makeDesktopItem {
name = pname;
exec = pname;
icon = uid;
desktopName = pname;
categories = ["Game"];
})
];
desktopIcon = makeDesktopIcon {
name = uid;
icoIndex = 0;
src = fetchurl {
url = "https://pokemonuranium.co/img/logos/xuraniumlogocalc.png.pagespeed.ic.j2M-X6L-RW.png";
hash = "sha256-qwY3KiroXFaIb/UXw9xxejYaRzpuIjPFZ2Vi2NNZnKw=";
};
};
}