Nix expr: build w/o `.git`, fix debugPInvokes, add comment re: Cachix
This commit is contained in:
parent
c8ef579b8f
commit
3d5578df1a
|
@ -58,7 +58,7 @@ in rec {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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}MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll
|
${commentUnless debugPInvokes}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll
|
||||||
if [ "$1" = "--mono-no-redirect" ]; then
|
if [ "$1" = "--mono-no-redirect" ]; then
|
||||||
shift
|
shift
|
||||||
printf "(received --mono-no-redirect, stdout was not captured)\n" >EmuHawkMono_laststdout.txt
|
printf "(received --mono-no-redirect, stdout was not captured)\n" >EmuHawkMono_laststdout.txt
|
||||||
|
|
56
default.nix
56
default.nix
|
@ -1,4 +1,5 @@
|
||||||
# THIS IS A WORK IN PROGRESS!
|
# THIS IS A WORK IN PROGRESS!
|
||||||
|
# To save you having to build Mono locally, install the Cachix client (`nix-env -iA nixpkgs.cachix`) and run `cachix use mono-for-bizhawk` (both commands only need to run once ever). See https://docs.cachix.org for more info.
|
||||||
|
|
||||||
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz") {}
|
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz") {}
|
||||||
# infrastructure
|
# infrastructure
|
||||||
|
@ -9,26 +10,33 @@
|
||||||
, makeWrapper ? pkgs.makeWrapper
|
, makeWrapper ? pkgs.makeWrapper
|
||||||
# source
|
# source
|
||||||
, useCWDAsSource ? false
|
, useCWDAsSource ? false
|
||||||
, hawkVersion ? if useCWDAsSource then "2.7.1-local" else "2.7" # used to distinguish parallel installs' config and other data
|
, hawkSourceInfo ? if useCWDAsSource
|
||||||
, hawkSource ? if useCWDAsSource
|
then rec {
|
||||||
then builtins.path {
|
version = "2.7.1-local"; # distinguishes parallel installs' config and other data
|
||||||
path = ./.;
|
shorthash = "000000000"; # this and the branch name are written into movies and savestates, written to config to detect in-place upgrades (N/A to Nix), and of course also shown in the About dialog
|
||||||
name = "BizHawk-${hawkVersion}";
|
branch = "master"; # must be regex-escaped (interpolated as `sed "s/.../${branch}/"`)
|
||||||
filter = let
|
drv = builtins.path {
|
||||||
denyList = [ ".idea" "ExternalCoreProjects" "ExternalProjects" "ExternalToolProjects" "libHawk" "libmupen64plus" "LibretroBridge" "LuaInterface" "lynx" "psx" "quicknes" "submodules" "waterbox" "wonderswan" ];
|
path = ./.;
|
||||||
in path: type: type == "regular" || (type == "directory" && !builtins.elem (baseNameOf path) denyList);
|
name = "BizHawk-${version}";
|
||||||
|
filter = let # this is just for speed, not any r13y concern
|
||||||
|
denyList = [ ".idea" "ExternalCoreProjects" "ExternalProjects" "ExternalToolProjects" "libHawk" "libmupen64plus" "LibretroBridge" "LuaInterface" "lynx" "psx" "quicknes" "submodules" "waterbox" "wonderswan" ];
|
||||||
|
in path: type: type == "regular" || (type == "directory" && !builtins.elem (baseNameOf path) denyList);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else fetchFromGitHub {
|
else {
|
||||||
owner = "TASEmulators";
|
version = "2.7";
|
||||||
repo = "BizHawk";
|
shorthash = "dbaf25956";
|
||||||
rev = "dbaf2595625f79093eeec37d2d4a7a9a4d37f370";
|
branch = "master";
|
||||||
hash = "sha256-AQhnBy8lSiuFqA6I7lk6M1u3osAJEoEMELGDgGC/aII="; # changes randomly? maybe when submodules are changed? --yoshi
|
drv = fetchFromGitHub {
|
||||||
leaveDotGit = true;
|
owner = "TASEmulators";
|
||||||
|
repo = "BizHawk";
|
||||||
|
rev = "dbaf2595625f79093eeec37d2d4a7a9a4d37f370";
|
||||||
|
hash = "sha256-KXe69svPIIFaXgT9t+02pwdQ6WWqdqgUdtaE2S4/YxA=";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
# makedeps
|
# makedeps
|
||||||
, dotnet-sdk_5 ? pkgs.dotnetCorePackages.sdk_5_0
|
, dotnet-sdk_5 ? pkgs.dotnetCorePackages.sdk_5_0
|
||||||
, dotnet-sdk_6 ? pkgs.dotnetCorePackages.sdk_6_0
|
, dotnet-sdk_6 ? pkgs.dotnetCorePackages.sdk_6_0
|
||||||
, git ? pkgs.git
|
|
||||||
, p7zip ? pkgs.p7zip
|
, p7zip ? pkgs.p7zip
|
||||||
# rundeps for NixOS hosts
|
# rundeps for NixOS hosts
|
||||||
#, gtk2-x11 ? pkgs.gtk2-x11
|
#, gtk2-x11 ? pkgs.gtk2-x11
|
||||||
|
@ -55,14 +63,21 @@ let
|
||||||
else pkgs.callPackage Dist/mono-6.12.0.151.nix {}; # not actually reproducible :( https://github.com/NixOS/nixpkgs/issues/143110#issuecomment-984251253
|
else pkgs.callPackage Dist/mono-6.12.0.151.nix {}; # not actually reproducible :( https://github.com/NixOS/nixpkgs/issues/143110#issuecomment-984251253
|
||||||
bizhawk = buildDotnetModule rec {
|
bizhawk = buildDotnetModule rec {
|
||||||
pname = "BizHawk";
|
pname = "BizHawk";
|
||||||
version = hawkVersion;
|
version = hawkSourceInfo.version;
|
||||||
src = hawkSource;
|
src = hawkSourceInfo.drv;
|
||||||
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 = [ git p7zip ];
|
nativeBuildInputs = [ p7zip ];
|
||||||
buildInputs = [ mesa monoFinal openal uname ];# ++ lib.optionals (forNixOS) [ gtk2-x11 ];
|
buildInputs = [ mesa monoFinal openal uname ];# ++ lib.optionals (forNixOS) [ gtk2-x11 ];
|
||||||
projectFile = "BizHawk.sln";
|
projectFile = "BizHawk.sln";
|
||||||
nugetDeps = if useCWDAsSource then Dist/deps.nix else Dist/deps-old.nix;
|
nugetDeps = if useCWDAsSource then Dist/deps.nix else Dist/deps-old.nix;
|
||||||
extraDotnetBuildFlags = "-maxcpucount:$NIX_BUILD_CORES -p:BuildInParallel=true --no-restore";
|
extraDotnetBuildFlags = "-maxcpucount:$NIX_BUILD_CORES -p:BuildInParallel=true --no-restore";
|
||||||
|
postPatch = ''
|
||||||
|
# confused? '$(...)' is literal here
|
||||||
|
# these scripts invoke Git in subshells and we want to run them now, at compile time, without Git
|
||||||
|
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 's/$(git rev-list HEAD --count)//' Build/standin.sh # const field is unused
|
||||||
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${commentUnless useCWDAsSource}cd src/BizHawk.Version
|
${commentUnless useCWDAsSource}cd src/BizHawk.Version
|
||||||
${commentUnless useCWDAsSource}dotnet build ${extraDotnetBuildFlags}
|
${commentUnless useCWDAsSource}dotnet build ${extraDotnetBuildFlags}
|
||||||
|
@ -89,14 +104,15 @@ let
|
||||||
};
|
};
|
||||||
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 hawkVersion initConfig;
|
inherit commentUnless versionAtLeast mesa openal debugPInvokes initConfig;
|
||||||
|
hawkVersion = hawkSourceInfo.version;
|
||||||
mono = monoFinal;
|
mono = monoFinal;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
bizhawkAssemblies = bizhawk;
|
bizhawkAssemblies = bizhawk;
|
||||||
emuhawk = stdenv.mkDerivation rec {
|
emuhawk = stdenv.mkDerivation rec {
|
||||||
pname = "emuhawk-monort";
|
pname = "emuhawk-monort";
|
||||||
version = hawkVersion;
|
version = hawkSourceInfo.version;
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ bizhawk ];
|
buildInputs = [ bizhawk ];
|
||||||
# there must be a helper for this somewhere...
|
# there must be a helper for this somewhere...
|
||||||
|
|
Loading…
Reference in New Issue