Nix expr: DiscoHawk

This commit is contained in:
YoshiRulz 2022-01-20 12:26:54 +10:00
parent 022cb02f3e
commit a5a8e85a91
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 34 additions and 9 deletions

View File

@ -39,6 +39,18 @@ let
};
} // initConfig));
in rec {
discoWrapper = writeShellScriptBin "discohawk-wrapper" ''
set -e
if [ ! -e "$BIZHAWK_HOME/EmuHawk.exe" ]; then
printf "no such file: %s\n" "$BIZHAWK_HOME/EmuHawk.exe"
exit 1
fi
export LD_LIBRARY_PATH="$BIZHAWK_HOME/dll"
${commentUnless debugPInvokes}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll
exec ${mono}/bin/mono "$BIZHAWK_HOME/DiscoHawk.exe" "$@"
'';
wrapperScript = writeShellScriptBin "emuhawk-wrapper" ''
set -e

View File

@ -117,11 +117,10 @@ let
hawkVersion = hawkSourceInfo.version;
mono = monoFinal;
};
in {
bizhawkAssemblies = bizhawk; # assemblies and dependencies, and some other immutable things like the gamedb, are in the `bin` output; the rest of the "assets" (bundled scripts, palettes, etc.) are in the `out` output
emuhawk = stdenv.mkDerivation rec {
pname = "emuhawk-monort";
mkWrapperWrapper = { pname, innerWrapper, desktopName }: stdenv.mkDerivation rec {
inherit pname;
version = hawkSourceInfo.version;
exeName = "${pname}-${version}";
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ bizhawk ];
# there must be a helper for this somewhere...
@ -131,16 +130,30 @@ in {
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
makeWrapper ${if forNixOS then "${wrapperScripts.wrapperScript}/bin/emuhawk-wrapper" else "${wrapperScripts.wrapperScriptNonNixOS}/bin/emuhawk-wrapper-non-nixos"} $out/bin/${pname}-${version} \
makeWrapper ${innerWrapper} $out/bin/${exeName} \
--set BIZHAWK_HOME ${bizhawk}
'';
dontFixup = true;
# desktopItems = [ (makeDesktopItem rec {
# name = "emuhawk-monort-${version}"; # actually filename
# exec = "${pname}-monort-${version}";
# desktopName = "EmuHawk (Mono Runtime)"; # actually Name
# desktopItems = [ (makeDesktopItem {
# name = "${pname}-${version}"; # actually filename
# exec = "${exeName}";
# inherit desktopName; # actually Name
# }) ];
};
in {
bizhawkAssemblies = bizhawk; # assemblies and dependencies, and some other immutable things like the gamedb, are in the `bin` output; the rest of the "assets" (bundled scripts, palettes, etc.) are in the `out` output
discohawk = mkWrapperWrapper {
pname = "discohawk-monort";
innerWrapper = "${wrapperScripts.discoWrapper}/bin/discohawk-wrapper";
desktopName = "DiscoHawk (Mono Runtime)";
};
emuhawk = mkWrapperWrapper {
pname = "emuhawk-monort";
innerWrapper = if forNixOS
then "${wrapperScripts.wrapperScript}/bin/emuhawk-wrapper"
else "${wrapperScripts.wrapperScriptNonNixOS}/bin/emuhawk-wrapper-non-nixos";
desktopName = "EmuHawk (Mono Runtime)";
};
emuhawkWrapperScriptNonNixOS = wrapperScripts.wrapperScriptNonNixOS;
mono = monoFinal;
}