Skip to content

Commit a5a8e85

Browse files
committed
Nix expr: DiscoHawk
1 parent 022cb02 commit a5a8e85

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

Dist/wrapper-scripts.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ let
3939
};
4040
} // initConfig));
4141
in rec {
42+
discoWrapper = writeShellScriptBin "discohawk-wrapper" ''
43+
set -e
44+
45+
if [ ! -e "$BIZHAWK_HOME/EmuHawk.exe" ]; then
46+
printf "no such file: %s\n" "$BIZHAWK_HOME/EmuHawk.exe"
47+
exit 1
48+
fi
49+
50+
export LD_LIBRARY_PATH="$BIZHAWK_HOME/dll"
51+
${commentUnless debugPInvokes}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll
52+
exec ${mono}/bin/mono "$BIZHAWK_HOME/DiscoHawk.exe" "$@"
53+
'';
4254
wrapperScript = writeShellScriptBin "emuhawk-wrapper" ''
4355
set -e
4456

default.nix

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ let
117117
hawkVersion = hawkSourceInfo.version;
118118
mono = monoFinal;
119119
};
120-
in {
121-
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
122-
emuhawk = stdenv.mkDerivation rec {
123-
pname = "emuhawk-monort";
120+
mkWrapperWrapper = { pname, innerWrapper, desktopName }: stdenv.mkDerivation rec {
121+
inherit pname;
124122
version = hawkSourceInfo.version;
123+
exeName = "${pname}-${version}";
125124
nativeBuildInputs = [ makeWrapper ];
126125
buildInputs = [ bizhawk ];
127126
# there must be a helper for this somewhere...
@@ -131,16 +130,30 @@ in {
131130
dontBuild = true;
132131
installPhase = ''
133132
mkdir -p $out/bin
134-
makeWrapper ${if forNixOS then "${wrapperScripts.wrapperScript}/bin/emuhawk-wrapper" else "${wrapperScripts.wrapperScriptNonNixOS}/bin/emuhawk-wrapper-non-nixos"} $out/bin/${pname}-${version} \
133+
makeWrapper ${innerWrapper} $out/bin/${exeName} \
135134
--set BIZHAWK_HOME ${bizhawk}
136135
'';
137136
dontFixup = true;
138-
# desktopItems = [ (makeDesktopItem rec {
139-
# name = "emuhawk-monort-${version}"; # actually filename
140-
# exec = "${pname}-monort-${version}";
141-
# desktopName = "EmuHawk (Mono Runtime)"; # actually Name
137+
# desktopItems = [ (makeDesktopItem {
138+
# name = "${pname}-${version}"; # actually filename
139+
# exec = "${exeName}";
140+
# inherit desktopName; # actually Name
142141
# }) ];
143142
};
143+
in {
144+
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
145+
discohawk = mkWrapperWrapper {
146+
pname = "discohawk-monort";
147+
innerWrapper = "${wrapperScripts.discoWrapper}/bin/discohawk-wrapper";
148+
desktopName = "DiscoHawk (Mono Runtime)";
149+
};
150+
emuhawk = mkWrapperWrapper {
151+
pname = "emuhawk-monort";
152+
innerWrapper = if forNixOS
153+
then "${wrapperScripts.wrapperScript}/bin/emuhawk-wrapper"
154+
else "${wrapperScripts.wrapperScriptNonNixOS}/bin/emuhawk-wrapper-non-nixos";
155+
desktopName = "EmuHawk (Mono Runtime)";
156+
};
144157
emuhawkWrapperScriptNonNixOS = wrapperScripts.wrapperScriptNonNixOS;
145158
mono = monoFinal;
146159
}

0 commit comments

Comments
 (0)