Nix expr: copy bundled scripts, shaders, etc. to ~/.local/share
TODOs excepted, this brings the Nix build to feature-parity with "portable"/AUR builds... if it runs at all (i.e. for the distros in `wrapper-scripts.nix`)
This commit is contained in:
parent
fdee066fd1
commit
878b22e8c5
|
@ -5,6 +5,7 @@
|
||||||
, writeShellScriptBin
|
, writeShellScriptBin
|
||||||
, writeText
|
, writeText
|
||||||
# rundeps
|
# rundeps
|
||||||
|
, bizhawk
|
||||||
, mesa
|
, mesa
|
||||||
, mono
|
, mono
|
||||||
, openal
|
, openal
|
||||||
|
@ -49,13 +50,16 @@ in rec {
|
||||||
BIZHAWK_DATA_HOME="$HOME/.local/share"
|
BIZHAWK_DATA_HOME="$HOME/.local/share"
|
||||||
fi
|
fi
|
||||||
BIZHAWK_DATA_HOME="$BIZHAWK_DATA_HOME/emuhawk-monort-${hawkVersion}"
|
BIZHAWK_DATA_HOME="$BIZHAWK_DATA_HOME/emuhawk-monort-${hawkVersion}"
|
||||||
mkdir -p "$BIZHAWK_DATA_HOME"
|
if [ ! -e "$BIZHAWK_DATA_HOME" ]; then
|
||||||
cd "$BIZHAWK_DATA_HOME"
|
mkdir -p "$BIZHAWK_DATA_HOME"
|
||||||
|
cd "${bizhawk.out}"
|
||||||
if [ ! -e config.json ]; then
|
find . -type f -not -wholename "./nix-support/*" -exec install -DvT "{}" "$BIZHAWK_DATA_HOME/{}" \;
|
||||||
cat ${initConfigFile} >config.json # cp kept the perms as 444 -- don't @ me
|
|
||||||
sed -i "s@%%BIZHAWK_DATA_HOME%%@$BIZHAWK_DATA_HOME@g" config.json
|
|
||||||
fi
|
fi
|
||||||
|
if [ ! -e "$BIZHAWK_DATA_HOME/config.json" ]; then
|
||||||
|
sed "s@%%BIZHAWK_DATA_HOME%%@$BIZHAWK_DATA_HOME@g" "${initConfigFile}" >"$BIZHAWK_DATA_HOME/config.json"
|
||||||
|
printf "wrote initial config to %s\n" "$BIZHAWK_DATA_HOME/config.json"
|
||||||
|
fi
|
||||||
|
cd "$BIZHAWK_DATA_HOME"
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=$BIZHAWK_HOME/dll:$BIZHAWK_GLHACKDIR:${lib.makeLibraryPath [ openal ]}
|
export LD_LIBRARY_PATH=$BIZHAWK_HOME/dll:$BIZHAWK_GLHACKDIR:${lib.makeLibraryPath [ openal ]}
|
||||||
${commentUnless debugPInvokes}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll
|
${commentUnless debugPInvokes}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll
|
||||||
|
|
19
default.nix
19
default.nix
|
@ -65,6 +65,7 @@ let
|
||||||
pname = "BizHawk";
|
pname = "BizHawk";
|
||||||
version = hawkSourceInfo.version;
|
version = hawkSourceInfo.version;
|
||||||
src = hawkSourceInfo.drv;
|
src = hawkSourceInfo.drv;
|
||||||
|
outputs = [ "bin" "out" ];
|
||||||
dotnet-sdk = if useCWDAsSource then dotnet-sdk_6 else dotnet-sdk_5;
|
dotnet-sdk = if useCWDAsSource then dotnet-sdk_6 else dotnet-sdk_5;
|
||||||
nativeBuildInputs = [ p7zip ];
|
nativeBuildInputs = [ p7zip ];
|
||||||
buildInputs = [ mesa monoFinal openal uname ];# ++ lib.optionals (forNixOS) [ gtk2-x11 ];
|
buildInputs = [ mesa monoFinal openal uname ];# ++ lib.optionals (forNixOS) [ gtk2-x11 ];
|
||||||
|
@ -77,6 +78,10 @@ let
|
||||||
sed -i 's/$(git rev-parse --verify HEAD)/${hawkSourceInfo.shorthash}/' Dist/.InvokeCLIOnMainSln.sh
|
sed -i 's/$(git rev-parse --verify HEAD)/${hawkSourceInfo.shorthash}/' Dist/.InvokeCLIOnMainSln.sh
|
||||||
sed -i -e 's/$(git rev-parse --abbrev-ref HEAD)/${hawkSourceInfo.branch}/' -e 's/$(git log -1 --format="%h")/${hawkSourceInfo.shorthash}/' Build/standin.sh
|
sed -i -e 's/$(git rev-parse --abbrev-ref HEAD)/${hawkSourceInfo.branch}/' -e 's/$(git log -1 --format="%h")/${hawkSourceInfo.shorthash}/' Build/standin.sh
|
||||||
sed -i 's/$(git rev-list HEAD --count)//' Build/standin.sh # const field is unused
|
sed -i 's/$(git rev-list HEAD --count)//' Build/standin.sh # const field is unused
|
||||||
|
|
||||||
|
# stop MSBuild from copying Assets, we'll do that later
|
||||||
|
sed -i '/Assets\/\*\*/d' src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
|
||||||
|
sed -i '/mkdir "packaged_output\/Firmware/d' Dist/Package.sh # and we don't need this
|
||||||
'';
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${commentUnless useCWDAsSource}cd src/BizHawk.Version
|
${commentUnless useCWDAsSource}cd src/BizHawk.Version
|
||||||
|
@ -85,7 +90,6 @@ let
|
||||||
Dist/Build${buildConfig}.sh ${extraDotnetBuildFlags}
|
Dist/Build${buildConfig}.sh ${extraDotnetBuildFlags}
|
||||||
printf "Nix" >output/dll/custombuild.txt
|
printf "Nix" >output/dll/custombuild.txt
|
||||||
Dist/Package.sh linux-x64
|
Dist/Package.sh linux-x64
|
||||||
rm packaged_output/EmuHawkMono.sh # replaced w/ below script(s)
|
|
||||||
'';
|
'';
|
||||||
inherit doCheck;
|
inherit doCheck;
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
|
@ -97,19 +101,24 @@ let
|
||||||
# Dist/Build${buildConfig}.sh -p:MachineRunAnalyzersDuringBuild=true ${extraDotnetBuildFlags}
|
# Dist/Build${buildConfig}.sh -p:MachineRunAnalyzersDuringBuild=true ${extraDotnetBuildFlags}
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out
|
cp -avT packaged_output $bin
|
||||||
cp -aTv packaged_output $out
|
cp -avt $bin Assets/defctrl.json && rm Assets/defctrl.json
|
||||||
|
cp -avt $bin/dll Assets/dll/* && rm -r Assets/dll
|
||||||
|
rm Assets/EmuHawkMono.sh # replaced w/ scripts from wrapperScripts
|
||||||
|
cp -avt $bin Assets/gamedb && rm -r Assets/gamedb
|
||||||
|
cp -avt $bin Assets/Shaders && rm -r Assets/Shaders
|
||||||
|
cp -avT Assets $out
|
||||||
'';
|
'';
|
||||||
dontPatchELF = true;
|
dontPatchELF = true;
|
||||||
};
|
};
|
||||||
wrapperScripts = import Dist/wrapper-scripts.nix {
|
wrapperScripts = import Dist/wrapper-scripts.nix {
|
||||||
inherit (pkgs) lib writeShellScriptBin writeText;
|
inherit (pkgs) lib writeShellScriptBin writeText;
|
||||||
inherit commentUnless versionAtLeast mesa openal debugPInvokes initConfig;
|
inherit commentUnless versionAtLeast bizhawk mesa openal debugPInvokes initConfig;
|
||||||
hawkVersion = hawkSourceInfo.version;
|
hawkVersion = hawkSourceInfo.version;
|
||||||
mono = monoFinal;
|
mono = monoFinal;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
bizhawkAssemblies = bizhawk;
|
bizhawkAssemblies = bizhawk; # assemblies, dependencies, and the gamedb are in `bin` output; bundled scripts, shaders, etc. are in `out` output
|
||||||
emuhawk = stdenv.mkDerivation rec {
|
emuhawk = stdenv.mkDerivation rec {
|
||||||
pname = "emuhawk-monort";
|
pname = "emuhawk-monort";
|
||||||
version = hawkSourceInfo.version;
|
version = hawkSourceInfo.version;
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
var gameDbEntry = Emulator.AsGameDBEntryGenerator().GenerateGameDbEntry();
|
var gameDbEntry = Emulator.AsGameDBEntryGenerator().GenerateGameDbEntry();
|
||||||
gameDbEntry.Status = picker.PickedStatus;
|
gameDbEntry.Status = picker.PickedStatus;
|
||||||
Database.SaveDatabaseEntry(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb", "gamedb_user.txt"), gameDbEntry);
|
Database.SaveDatabaseEntry(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb", "gamedb_user.txt"), gameDbEntry); //TODO read-only in Nix builds
|
||||||
MainForm.UpdateDumpInfo(gameDbEntry.Status);
|
MainForm.UpdateDumpInfo(gameDbEntry.Status);
|
||||||
HideShowGameDbButton();
|
HideShowGameDbButton();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue