Nix expr: Add binary releases back to 2.3.2, some cleanup

This commit is contained in:
James Groom 2023-11-21 04:15:37 +00:00 committed by GitHub
parent 83ec4594d6
commit dada959cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 150 additions and 50 deletions

View File

@ -1,6 +1,6 @@
{ lib { lib
# infrastructure # infrastructure
, drvVersionAtLeast , isVersionAtLeast
, replaceDotWithUnderscore , replaceDotWithUnderscore
, fetchFromGitHub , fetchFromGitHub
, fetchFromGitLab , fetchFromGitLab
@ -13,14 +13,17 @@
* updating? make sure to hit the rest of this file, the hand-written deps `/Dist/deps-historical.nix`, * updating? make sure to hit the rest of this file, the hand-written deps `/Dist/deps-historical.nix`,
* the shell script for CI `/Dist/nix_expr_check_attrs.sh`, and the docs `/Dist/nix_expr_usage_docs.md` * the shell script for CI `/Dist/nix_expr_check_attrs.sh`, and the docs `/Dist/nix_expr_usage_docs.md`
*/ */
releases = [ "2.9.1" "2.9" "2.8" "2.7" "2.6.3" "2.6.2" "2.6.1" "2.6" ]; releases = [
"2.9.1" "2.9" "2.8" "2.7" "2.6.3" "2.6.2" "2.6.1" "2.6"
"2.5.2" "2.5.1" "2.5" "2.4.2" "2.4.1" "2.4" "2.3.3" "2.3.2"
];
releaseCount = lib.length releases; releaseCount = lib.length releases;
releaseFrags = builtins.map replaceDotWithUnderscore releases; releaseFrags = builtins.map replaceDotWithUnderscore releases;
releaseOffsetLookup = lib.listToAttrs (lib.imap0 (lib.flip lib.nameValuePair) releaseFrags); releaseOffsetLookup = lib.listToAttrs (lib.imap0 (lib.flip lib.nameValuePair) releaseFrags);
depsForHistoricalRelease = releaseFrag: fetchNuGet: let depsForHistoricalRelease = releaseFrag: fetchNuGet: let
file = import ./deps-historical.nix; file = import ./deps-historical.nix;
windows = (builtins.map (s: file."since-${s}") releaseFrags) ++ (builtins.map (s: file."until-${s}") releaseFrags); windows = builtins.map (s: file."since-${s}" or []) releaseFrags ++ builtins.map (s: file."until-${s}" or []) releaseFrags;
extras = builtins.map (s: file."only-${s}") releaseFrags; extras = builtins.map (s: file."only-${s}" or []) releaseFrags;
i = releaseOffsetLookup.${releaseFrag}; i = releaseOffsetLookup.${releaseFrag};
in builtins.map fetchNuGet (lib.elemAt extras i ++ lib.concatLists (lib.sublist i releaseCount windows)); in builtins.map fetchNuGet (lib.elemAt extras i ++ lib.concatLists (lib.sublist i releaseCount windows));
releaseTagSourceInfos = let releaseTagSourceInfos = let
@ -36,11 +39,10 @@
}; };
in (lib.optionalAttrs (dotnet-sdk != null) { inherit dotnet-sdk; }) // { in (lib.optionalAttrs (dotnet-sdk != null) { inherit dotnet-sdk; }) // {
inherit shortHash version; inherit shortHash version;
branch = "master"; src = fetchFromGitHub (fetcherArgs // { owner = "TASEmulators"; });
drv = fetchFromGitHub (fetcherArgs // { owner = "TASEmulators"; });
#TODO can use `srcs` w/ `buildDotnetModule`? #TODO can use `srcs` w/ `buildDotnetModule`?
# verified hashes match for 2.7 through 2.9, but 2.9.1 rev (745efb1dd) was missing (force-push nonsense IIRC) # verified hashes match for 2.7 through 2.9, but 2.9.1 rev (745efb1dd) was missing (force-push nonsense IIRC)
drv1 = fetchFromGitLab (fetcherArgs // { owner = "TASVideos"; }); src1 = fetchFromGitLab (fetcherArgs // { owner = "TASVideos"; });
nugetDeps = let nugetDeps = let
releaseFrag = replaceDotWithUnderscore version; releaseFrag = replaceDotWithUnderscore version;
in mkNugetDeps { in mkNugetDeps {
@ -138,6 +140,47 @@
hashPostPatching = "sha256-kswmNENYxumQlJdUKRQcb5Ni5+aXUqKxEnJ8jX5OHQ0="; hashPostPatching = "sha256-kswmNENYxumQlJdUKRQcb5Ni5+aXUqKxEnJ8jX5OHQ0=";
dotnet-sdk = dotnet-sdk_5; dotnet-sdk = dotnet-sdk_5;
}; };
# if you want to get these building from source, start by changing `releasesEmuHawkInstallables` in `default.nix` so the attrs are actually exposed
info-2_5_2 = {
version = "2.5.2";
rev = "21a476200e76ef815d2bb66dffc167f9720a4eb9";
hashPostPatching = "";
};
info-2_5_1 = {
version = "2.5.1";
rev = "f104807193bd5a4bffdd67d52967ab844038775e";
hashPostPatching = "";
};
info-2_5 = {
version = "2.5";
rev = "5b93ef14dc613417eb937c1f793dd2dfb851d717";
hashPostPatching = "";
};
info-2_4_2 = {
version = "2.4.2";
rev = "546ccda9189e346840909350eca8b1fdcadad081";
hashPostPatching = "";
};
info-2_4_1 = {
version = "2.4.1";
rev = "60a1ddea5e4775f3be4bd417d53cacf0eba978c4";
hashPostPatching = "";
};
info-2_4 = {
version = "2.4";
rev = "16f5da9f9c2e57ac7a8bb70b2028e3a9501127b8";
hashPostPatching = "";
};
info-2_3_3 = {
version = "2.3.3";
rev = "c330541c35e97c66df31d1616a69927cf65bf318";
hashPostPatching = "";
};
info-2_3_2 = {
version = "2.3.2";
rev = "92847b1d1d534108143cfbff1e266036332c0573";
hashPostPatching = "";
};
}; };
in { in {
inherit depsForHistoricalRelease releaseFrags releaseTagSourceInfos; inherit depsForHistoricalRelease releaseFrags releaseTagSourceInfos;
@ -145,40 +188,51 @@ in {
populateHawkSourceInfo = hawkSourceInfo: let populateHawkSourceInfo = hawkSourceInfo: let
inherit (hawkSourceInfo) version; inherit (hawkSourceInfo) version;
neededExtraManagedDepsApprox = [ "virtu" ] neededExtraManagedDepsApprox = [ "virtu" ]
++ lib.optionals (drvVersionAtLeast "2.6" version) [ "hawkQuantizer" "isoParser" ] ++ lib.optionals (isVersionAtLeast "2.6" version) [ "hawkQuantizer" "isoParser" ]
++ lib.optionals (drvVersionAtLeast "2.6.2" version) [ "flatBuffersGenOutput" "srcGenReflectionCache" ] ++ lib.optionals (isVersionAtLeast "2.6.2" version) [ "flatBuffersGenOutput" "srcGenReflectionCache" ]
++ lib.optionals (!drvVersionAtLeast "2.9" version) [ "flatBuffersCore" "gongShell" ] ++ lib.optionals (!isVersionAtLeast "2.9" version) [ "flatBuffersCore" "gongShell" ]
++ lib.optionals (drvVersionAtLeast "2.9" version) [ "bizhawkAnalyzer" "nlua" ] ++ lib.optionals (isVersionAtLeast "2.9" version) [ "bizhawkAnalyzer" "nlua" ]
++ lib.optional (drvVersionAtLeast "2.9.1" version) "srcGenVersionInfo" ++ lib.optional (isVersionAtLeast "2.9.1" version) "srcGenVersionInfo"
++ lib.optionals (!drvVersionAtLeast "2.9.2" version) [ "slimDX" "systemDataSqliteDropIn" ] ++ lib.optionals (!isVersionAtLeast "2.9.2" version) [ "slimDX" "systemDataSqliteDropIn" ]
++ lib.optional (drvVersionAtLeast "2.9.2" version) "srcGenSettingsUtil" ++ lib.optional (isVersionAtLeast "2.9.2" version) "srcGenSettingsUtil"
; ;
in { in {
inherit neededExtraManagedDepsApprox; inherit neededExtraManagedDepsApprox;
__contentAddressed = false; #TODO try w/ CA __contentAddressed = false; #TODO try w/ CA
copyingAssetsInEmuHawkProj = drvVersionAtLeast "2.6.3" version; copyingAssetsInEmuHawkProj = isVersionAtLeast "2.6.3" version;
dotnet-sdk = dotnet-sdk_6; dotnet-sdk = dotnet-sdk_6;
exePathRespectsEnvVar = drvVersionAtLeast "2.9.2" version; exePathRespectsEnvVar = isVersionAtLeast "2.9.2" version;
hasAssetsInOutput = !drvVersionAtLeast "2.6.1" version; hasAssemblyResolveHandler = isVersionAtLeast "2.3.3" version;
hasFFmpegPatch_e68a49aa5 = drvVersionAtLeast "2.9.2" version; # with e68a49aa5, downloading *and running* FFmpeg finally works; TODO use FFmpeg from Nixpkgs since it's a stable version (4.4.1) hasAssetsInOutput = !isVersionAtLeast "2.6.1" version;
hasMiscTypeCheckerPatch_6afb3be98 = drvVersionAtLeast "2.6.2" version; hasFFmpegPatch_e68a49aa5 = isVersionAtLeast "2.9.2" version; # with e68a49aa5, downloading *and running* FFmpeg finally works; TODO use FFmpeg from Nixpkgs since it's a stable version (4.4.1)
hasMiscTypeCheckerPatch_6afb3be98 = isVersionAtLeast "2.6.2" version;
neededExtraManagedDeps = neededExtraManagedDepsApprox; neededExtraManagedDeps = neededExtraManagedDepsApprox;
needsSDL = drvVersionAtLeast "2.9.2" version; needsSDL = isVersionAtLeast "2.9.2" version;
nugetDeps = ./deps.nix; nugetDeps = ./deps.nix;
packageScriptNeeds7Zip = !drvVersionAtLeast "2.6.3" version; packageScriptNeeds7Zip = !isVersionAtLeast "2.6.3" version;
packageScriptRemovesWinFilesFromLinux = drvVersionAtLeast "2.9.2" version; packageScriptRemovesWinFilesFromLinux = isVersionAtLeast "2.9.2" version;
pathConfigNeedsOrdinal = !drvVersionAtLeast "2.7.1" version; pathConfigNeedsOrdinal = !isVersionAtLeast "2.7.1" version;
releaseArtifactHasRogueOTKAsmConfig = version == "2.9.1"; releaseArtifactHasRogueOTKAsmConfig = version == "2.9.1";
versionProjNeedsDoubleBuild = !drvVersionAtLeast "2.9.1" version; releaseArtifactNeedsLowercaseAsms = !isVersionAtLeast "2.3.3" version;
releaseArtifactNeedsOTKAsmConfig = isVersionAtLeast "2.3.3" version && !isVersionAtLeast "2.5" version; # see a1b501fe5
releaseArtifactNeedsVBDotnetReference = !isVersionAtLeast "2.5.1" version;
versionProjNeedsDoubleBuild = !isVersionAtLeast "2.9.1" version;
#TODO warn about missing/broken features when eval'ing older releases #TODO warn about missing/broken features when eval'ing older releases
} // hawkSourceInfo; } // hawkSourceInfo;
/** to be passed to `splitReleaseArtifact` */ /** to be passed to `splitReleaseArtifact` */
releaseArtifactInfos = lib.mapAttrs' releaseArtifactInfos = lib.mapAttrs'
(releaseFrag: value: { (releaseFrag: value: {
name = "bizhawkAssemblies-${releaseFrag}-bin"; name = "bizhawkAssemblies-${releaseFrag}-bin";
value = { value = let
hawkSourceInfo = releaseTagSourceInfos."info-${releaseFrag}" // { branch = "release"; } // value.hawkSourceInfo or {}; hawkSourceInfo = releaseTagSourceInfos."info-${releaseFrag}" // value.hawkSourceInfo or {};
} // value; in {
inherit hawkSourceInfo;
${if isVersionAtLeast "2.6" hawkSourceInfo.version
then if isVersionAtLeast "2.6.3" hawkSourceInfo.version
then null
else "zippedTarball"
else "crossPlatformArtifact"} = true;
} // lib.optionalAttrs (!isVersionAtLeast "2.6" hawkSourceInfo.version) { stripRoot = false; } // value;
}) })
{ {
"2_9_1" = { "2_9_1" = {
@ -200,16 +254,39 @@ in {
hashPrePatching = "sha256-gCHySfNOjqazbQDqk5lKJIYmPI6onqcaVDwuY8Ud2ns="; hashPrePatching = "sha256-gCHySfNOjqazbQDqk5lKJIYmPI6onqcaVDwuY8Ud2ns=";
}; };
"2_6_2" = { "2_6_2" = {
zippedTarball = true;
hashPrePatching = "sha256-tlnF/ZQOkLMbiEV2BqhxzQ/KixGZ30+LgOUoHvpv13s="; hashPrePatching = "sha256-tlnF/ZQOkLMbiEV2BqhxzQ/KixGZ30+LgOUoHvpv13s=";
}; };
"2_6_1" = { "2_6_1" = {
zippedTarball = true;
hashPrePatching = "sha256-Ou4NbRo7Gh0HWviXSEHtp0PpsGDdYsN8yhR0/gQy3rY="; hashPrePatching = "sha256-Ou4NbRo7Gh0HWviXSEHtp0PpsGDdYsN8yhR0/gQy3rY=";
}; };
"2_6" = { "2_6" = {
zippedTarball = true;
hashPrePatching = "sha256-AHP1mgedC9wUq+YAJD0gM4Lrl0H0UkrWyifEDC9KLog="; hashPrePatching = "sha256-AHP1mgedC9wUq+YAJD0gM4Lrl0H0UkrWyifEDC9KLog=";
}; };
"2_5_2" = {
hashPrePatching = "sha256-vurAHOSWwpHZ96cLnRvb6wR+6dvTVKgoqUvlU4Qyp3g=";
};
"2_5_1" = {
hashPrePatching = "sha256-tB6UXQPFHPIhV5bERkv/kAktyMn3dnlI4nzIwXO9imQ=";
};
"2_5" = {
url = "https://github.com/TASEmulators/BizHawk/releases/download/2.5/BizHawk-2.5.0.zip";
hashPrePatching = "sha256-OPuNxgHWYBCw6gkkllir0U9z+ZF3K8K2o24W00MWgLk=";
};
"2_4_2" = {
hashPrePatching = "sha256-0ZunzBTO4O+B89N5PI0+AeVFBhe9shEtCANsYJBVdaY=";
};
"2_4_1" = {
hashPrePatching = "sha256-uORUDsPh7ePRzB69wqKW65Cch35Fjg34Q0aa7Vcf+dA=";
};
"2_4" = {
hashPrePatching = "sha256-vgocYt0Wo5LSLxHF5W1aFi2xqkklMYhZP4zHOIFbCb0=";
};
"2_3_3" = {
hashPrePatching = "sha256-kLPNpnggnrc7TgA6NCC0P/tkFiUgTHVyKPdUz0UX1EE=";
};
"2_3_2" = {
hashPrePatching = "sha256-x2DwrzBkPAGhlov/eU/VwXuHVP/Rv0o7pZptmsSQLJU=";
};
# older releases won't pass prereq checker w/o WINE libs, relevant change was https://github.com/TASEmulators/BizHawk/commit/27a4062ea22e5cb4a81628580ce47fec7a2709a5#diff-aff17d6fcf6169cad48e9c8d08145b0de360e874aa8ffee0ea66e636cccda39f
}; };
} }

View File

@ -78,7 +78,8 @@
else else
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ldLibPath" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ldLibPath"
fi fi
${lib.optionalString (!debugPInvokes) "# "}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll # pass `--arg debugPInvokes true` to nix-build to enable ${if bizhawkAssemblies.hawkSourceInfo.hasAssemblyResolveHandler then "" else ''export MONO_PATH="$BIZHAWK_HOME/dll/nlua:$BIZHAWK_HOME/dll"
''}${lib.optionalString (!debugPInvokes) "# "}export MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll # pass `--arg debugPInvokes true` to nix-build to enable
${lib.optionalString debugDotnetHostCrashes "# "}export MONO_CRASH_NOFILE=1 # pass `--arg debugDotnetHostCrashes true` to nix-build to disable ${lib.optionalString debugDotnetHostCrashes "# "}export MONO_CRASH_NOFILE=1 # pass `--arg debugDotnetHostCrashes true` to nix-build to disable
if [ "$1" = '--mono-no-redirect' ]; then if [ "$1" = '--mono-no-redirect' ]; then
printf "(passing --mono-no-redirect is no longer necessary)\n" >&2 printf "(passing --mono-no-redirect is no longer necessary)\n" >&2

View File

@ -7,6 +7,7 @@ nix-instantiate --eval --strict -E 'import Dist/exposed-attr-checker.nix {}'
printf "\n" printf "\n"
attrNamesToCheck='discohawk-latest emuhawk-2_9_1 emuhawk-2_9 emuhawk-2_8 emuhawk-2_7 emuhawk-2_6_3 emuhawk-2_6_2 emuhawk-2_6_1 emuhawk-2_6' attrNamesToCheck='discohawk-latest emuhawk-2_9_1 emuhawk-2_9 emuhawk-2_8 emuhawk-2_7 emuhawk-2_6_3 emuhawk-2_6_2 emuhawk-2_6_1 emuhawk-2_6'
attrNamesToCheckBinOnly='emuhawk-2_5_2 emuhawk-2_5_1 emuhawk-2_5 emuhawk-2_4_2 emuhawk-2_4_1 emuhawk-2_4 emuhawk-2_3_3 emuhawk-2_3_2'
# not checking `forNixOS = false` since it's just the same wrapped with nixGL # not checking `forNixOS = false` since it's just the same wrapped with nixGL
#commonBuildFlags='--pure --arg doCheck true' # not working :( #commonBuildFlags='--pure --arg doCheck true' # not working :(
commonBuildFlags='--pure' commonBuildFlags='--pure'
@ -37,7 +38,7 @@ else
done done
fi fi
printf "Packaging releases.\n" printf "Packaging releases.\n"
for a in $attrNamesToCheck; do for a in $attrNamesToCheck $attrNamesToCheckBinOnly; do
b -A "$a-bin" b -A "$a-bin"
b -A "$a-bin.assemblies" --check b -A "$a-bin.assemblies" --check
done done

View File

@ -23,6 +23,14 @@ Version | Attr for asms | Attr for EmuHawk | Attr for DiscoHawk
2.6.1 from source | DIY | `emuhawk-2_6_1` | DIY 2.6.1 from source | DIY | `emuhawk-2_6_1` | DIY
2.6 | `bizhawkAssemblies-2_6-bin` | `emuhawk-2_6-bin` | DIY 2.6 | `bizhawkAssemblies-2_6-bin` | `emuhawk-2_6-bin` | DIY
2.6 from source | DIY | `emuhawk-2_6` | DIY 2.6 from source | DIY | `emuhawk-2_6` | DIY
2.5.2 | `bizhawkAssemblies-2_5_2-bin` | `emuhawk-2_5_2-bin` | DIY
2.5.1 | `bizhawkAssemblies-2_5_1-bin` | `emuhawk-2_5_1-bin` | DIY
2.5 | `bizhawkAssemblies-2_5-bin` | `emuhawk-2_5-bin` | DIY
2.4.2 | `bizhawkAssemblies-2_4_2-bin` | `emuhawk-2_4_2-bin` | DIY
2.4.1 | `bizhawkAssemblies-2_4_1-bin` | `emuhawk-2_4_1-bin` | DIY
2.4 | `bizhawkAssemblies-2_4-bin` | `emuhawk-2_4-bin` | DIY
2.3.3 | `bizhawkAssemblies-2_3_3-bin` | `emuhawk-2_3_3-bin` | DIY
2.3.2 | `bizhawkAssemblies-2_3_2-bin` | `emuhawk-2_3_2-bin` | DIY
Nix functions and data: Nix functions and data:
- `buildAssembliesFor` - `buildAssembliesFor`

View File

@ -2,7 +2,7 @@
grabFromReferences = { filePfx, subdir ? "" }: runCommand filePfx { grabFromReferences = { filePfx, subdir ? "" }: runCommand filePfx {
inherit (hawkSourceInfo) __contentAddressed; inherit (hawkSourceInfo) __contentAddressed;
meta.sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; meta.sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
} ''mkdir -p "$out${subdir}"; cp -vt "$out${subdir}" '${hawkSourceInfo.drv}/References${subdir}'/${filePfx}*''; } ''mkdir -p "$out${subdir}"; cp -vt "$out${subdir}" '${hawkSourceInfo.src}/References${subdir}/${filePfx}'*'';
in { #TODO build all but flatBuffersCore, gongShell, slimDX, and systemDataSqliteDropIn from source in { #TODO build all but flatBuffersCore, gongShell, slimDX, and systemDataSqliteDropIn from source
bizhawkAnalyzer = grabFromReferences { filePfx = "BizHawk.Analyzer"; }; bizhawkAnalyzer = grabFromReferences { filePfx = "BizHawk.Analyzer"; };
flatBuffersCore = grabFromReferences { filePfx = "FlatBuffers.Core"; }; flatBuffersCore = grabFromReferences { filePfx = "FlatBuffers.Core"; };

View File

@ -18,6 +18,7 @@
# rundeps # rundeps
, lua , lua
, mono , mono
, monoBasic
, openal , openal
, SDL2 , SDL2
, udev , udev
@ -47,9 +48,8 @@
* TODO replace this with something more like `buildExtraManagedDepsFor`; for existing Nix exprs see https://gitlab.com/YoshiRulz/yoshis-hawk-thoughts/-/issues/10 * TODO replace this with something more like `buildExtraManagedDepsFor`; for existing Nix exprs see https://gitlab.com/YoshiRulz/yoshis-hawk-thoughts/-/issues/10
*/ */
buildUnmanagedDepsFor = hawkSourceInfo: stdenv.mkDerivation { buildUnmanagedDepsFor = hawkSourceInfo: stdenv.mkDerivation {
inherit (hawkSourceInfo) version; inherit (hawkSourceInfo) src version;
pname = "bizhawk-native-deps"; pname = "bizhawk-native-deps";
src = hawkSourceInfo.drv;
dontBuild = true; dontBuild = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -73,10 +73,9 @@
extraManagedDeps = hawkSourceInfo.extraManagedDeps or buildExtraManagedDepsFor hawkSourceInfo; extraManagedDeps = hawkSourceInfo.extraManagedDeps or buildExtraManagedDepsFor hawkSourceInfo;
in buildDotnetModule (lib.fix (finalAttrs: { # proper `finalAttrs` not supported >:( in buildDotnetModule (lib.fix (finalAttrs: { # proper `finalAttrs` not supported >:(
inherit doCheck mono; inherit doCheck mono;
inherit (hawkSourceInfo) __contentAddressed dotnet-sdk nugetDeps version; inherit (hawkSourceInfo) __contentAddressed dotnet-sdk nugetDeps src version;
pname = "BizHawk"; pname = "BizHawk";
isLocalBuild = lib.hasSuffix "-local" finalAttrs.version; isLocalBuild = lib.hasSuffix "-local" finalAttrs.version;
src = hawkSourceInfo.drv;
postUnpack = lib.optionalString finalAttrs.isLocalBuild ''(cd BizHawk-*-local; Dist/CleanupBuildOutputDirs.sh)''; postUnpack = lib.optionalString finalAttrs.isLocalBuild ''(cd BizHawk-*-local; Dist/CleanupBuildOutputDirs.sh)'';
outputs = [ "out" "assets" "extraUnmanagedDeps" "waterboxCores" ]; outputs = [ "out" "assets" "extraUnmanagedDeps" "waterboxCores" ];
propagatedBuildOutputs = []; # without this, other outputs depend on `out` propagatedBuildOutputs = []; # without this, other outputs depend on `out`
@ -254,8 +253,9 @@ in {
splitReleaseArtifact = splitReleaseArtifact =
{ hawkSourceInfo { hawkSourceInfo
, hashPrePatching , hashPrePatching
, crossPlatformArtifact ? false
, zippedTarball ? false , zippedTarball ? false
, url ? "https://github.com/TASEmulators/BizHawk/releases/download/${hawkSourceInfo.version}/BizHawk-${hawkSourceInfo.version}-linux-x64${if zippedTarball then ".tar.zip" else ".tar.gz"}" , url ? "https://github.com/TASEmulators/BizHawk/releases/download/${hawkSourceInfo.version}/BizHawk-${hawkSourceInfo.version}${if crossPlatformArtifact then ".zip" else if zippedTarball then "-linux-x64.tar.zip" else "-linux-x64.tar.gz"}"
, stripRoot ? true , stripRoot ? true
}: assert buildConfig == "Release"; let }: assert buildConfig == "Release"; let
artifact = fetchzip { inherit stripRoot url; hash = hashPrePatching; }; artifact = fetchzip { inherit stripRoot url; hash = hashPrePatching; };
@ -275,10 +275,13 @@ in {
rm -f EmuHawkMono.sh rm -f EmuHawkMono.sh
${if hawkSourceInfo'.releaseArtifactHasRogueOTKAsmConfig then ''mv -ft dll OpenTK.dll.config ${if hawkSourceInfo'.releaseArtifactHasRogueOTKAsmConfig then ''mv -ft dll OpenTK.dll.config
'' else ""}rmdir Firmware '' else ""}rmdir Firmware
mkdir ExternalTools && touch ExternalTools/.keep mkdir -p ExternalTools; touch ExternalTools/.keep
mkdir -p $out; mv -t $out defctrl.json DiscoHawk.exe* dll EmuHawk.exe* gamedb Shaders mkdir -p $out; mv -t $out defctrl.json DiscoHawk.exe* dll EmuHawk.exe* gamedb [Ss]haders
printf '${emuhawkBuildFlavour}' >$out/dll/custombuild.txt ${if hawkSourceInfo'.releaseArtifactNeedsVBDotnetReference then ''cp -t $out/dll '${lib.getOutput "out" monoBasic}/usr/lib/mono/4.5/Microsoft.VisualBasic.dll'
'' else ""}${if hawkSourceInfo'.releaseArtifactNeedsLowercaseAsms then ''(cd $out/dll; for s in Client.Common Emulation.Cores; do cp BizHawk.$s.dll Bizhawk.$s.dll; done)
'' else ""}${if hawkSourceInfo'.releaseArtifactNeedsOTKAsmConfig then ''cp -t $out/dll '${releaseTagSourceInfos.info-2_6.src}/Assets/dll/OpenTK.dll.config'
'' else ""}printf '${emuhawkBuildFlavour}' >$out/dll/custombuild.txt
mkdir -p $extraUnmanagedDeps/lib; mv -t $extraUnmanagedDeps/lib $out/dll/*.so* mkdir -p $extraUnmanagedDeps/lib; mv -t $extraUnmanagedDeps/lib $out/dll/*.so*
mkdir -p $waterboxCores/dll; mv -t $waterboxCores/dll $out/dll/*.wbx* mkdir -p $waterboxCores/dll; mv -t $waterboxCores/dll $out/dll/*.wbx*

View File

@ -3,6 +3,7 @@
, stdenv ? pkgs.stdenvNoCC , stdenv ? pkgs.stdenvNoCC
# infrastructure # infrastructure
, buildDotnetModule ? pkgs.buildDotnetModule , buildDotnetModule ? pkgs.buildDotnetModule
, dpkg ? pkgs.dpkg
, fetchFromGitHub ? pkgs.fetchFromGitHub , fetchFromGitHub ? pkgs.fetchFromGitHub
, fetchFromGitLab ? pkgs.fetchFromGitLab , fetchFromGitLab ? pkgs.fetchFromGitLab
, fetchpatch ? pkgs.fetchpatch , fetchpatch ? pkgs.fetchpatch
@ -19,8 +20,7 @@
version = "2.9.2-local"; # used in default value of `BIZHAWK_DATA_HOME`, which distinguishes parallel installs' config and other data version = "2.9.2-local"; # used in default value of `BIZHAWK_DATA_HOME`, which distinguishes parallel installs' config and other data
in { in {
inherit version; inherit version;
branch = "master"; # must be regex-escaped (interpolated as `sed "s/.../${branch}/"`); 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 src = builtins.path { path = ./.; name = "BizHawk-${version}"; }; # source derivation; did have filter here for speed, but it wasn't faster and it wasn't correct and it couldn't be made correct and I'm mad
drv = builtins.path { path = ./.; name = "BizHawk-${version}"; }; # source derivation; did have filter here for speed, but it wasn't faster and it wasn't correct and it couldn't be made correct and I'm mad
} }
# makedeps # makedeps
, dotnet-sdk_6 ? pkgs.dotnet-sdk_6 , dotnet-sdk_6 ? pkgs.dotnet-sdk_6
@ -50,8 +50,8 @@ in {
, forNixOS ? true , forNixOS ? true
, initConfig ? {} # forwarded to Dist/launch-scripts.nix (see docs there) , initConfig ? {} # forwarded to Dist/launch-scripts.nix (see docs there)
}: let }: let
isVersionAtLeast = lib.flip lib.versionAtLeast; # I stand by this being the more useful param order w.r.t. currying
replaceDotWithUnderscore = s: lib.replaceStrings [ "." ] [ "_" ] s; replaceDotWithUnderscore = s: lib.replaceStrings [ "." ] [ "_" ] s;
drvVersionAtLeast = exVer: acVer: builtins.compareVersions exVer acVer <= 0;
/** you can't actually make hard links in the sandbox, so this just copies, and we'll rely on Nix' automatic deduping */ /** you can't actually make hard links in the sandbox, so this just copies, and we'll rely on Nix' automatic deduping */
hardLinkJoin = hardLinkJoin =
{ name { name
@ -72,7 +72,7 @@ in {
''; '';
inherit (import Dist/historical.nix { inherit (import Dist/historical.nix {
inherit lib inherit lib
drvVersionAtLeast replaceDotWithUnderscore isVersionAtLeast replaceDotWithUnderscore
fetchFromGitHub fetchFromGitLab mkNugetDeps fetchFromGitHub fetchFromGitLab mkNugetDeps
dotnet-sdk_5 dotnet-sdk_6; dotnet-sdk_5 dotnet-sdk_6;
}) depsForHistoricalRelease populateHawkSourceInfo releaseArtifactInfos releaseFrags releaseTagSourceInfos; }) depsForHistoricalRelease populateHawkSourceInfo releaseArtifactInfos releaseFrags releaseTagSourceInfos;
@ -94,10 +94,16 @@ in {
buildConfig doCheck emuhawkBuildFlavour extraDefines extraDotnetBuildFlags; buildConfig doCheck emuhawkBuildFlavour extraDefines extraDotnetBuildFlags;
mono = if mono != null mono = if mono != null
then mono # allow older Mono if set explicitly then mono # allow older Mono if set explicitly
else if drvVersionAtLeast "6.12.0.151" pkgs.mono.version else if isVersionAtLeast "6.12.0.151" pkgs.mono.version
then pkgs.mono then pkgs.mono
else lib.trace "provided Mono too old, using Mono from Nixpkgs 23.05" else lib.trace "provided Mono too old, using Mono from Nixpkgs 23.05"
(import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/23.05.tar.gz") {}).mono; (import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/23.05.tar.gz") {}).mono;
monoBasic = fetchzip {
url = "https://download.mono-project.com/repo/debian/pool/main/m/mono-basic/libmono-microsoft-visualbasic10.0-cil_4.7-0xamarin3+debian9b1_all.deb";
nativeBuildInputs = [ dpkg ];
hash = "sha256-2m1FwpDxzqVXR6GUB3oFuTqIXCde/msb+tg8v6lIN6s=";
# tried and failed building from source, following https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mono-basic
};
}; };
emuhawk-local = pp.buildEmuHawkInstallableFor { emuhawk-local = pp.buildEmuHawkInstallableFor {
inherit forNixOS; inherit forNixOS;
@ -106,8 +112,8 @@ in {
asmsFromReleaseArtifacts = lib.mapAttrs (_: pp.splitReleaseArtifact) releaseArtifactInfos; asmsFromReleaseArtifacts = lib.mapAttrs (_: pp.splitReleaseArtifact) releaseArtifactInfos;
# the asms for from-CWD and latest release from-source are exposed below as `bizhawkAssemblies` and `bizhawkAssemblies-latest`, respectively # the asms for from-CWD and latest release from-source are exposed below as `bizhawkAssemblies` and `bizhawkAssemblies-latest`, respectively
# apart from that, no `asmsFromSource`, since if you're only after the assets you might as well use the release artifact # apart from that, no `asmsFromSource`, since if you're only after the assets you might as well use the release artifact
releasesEmuHawkInstallables = lib.listToAttrs (lib.concatLists (builtins.map releasesEmuHawkInstallables = lib.pipe releaseFrags [
(versionFrag: [ (builtins.map (versionFrag: [
({ ({
name = "emuhawk-${versionFrag}"; name = "emuhawk-${versionFrag}";
value = pp.buildEmuHawkInstallableFor { value = pp.buildEmuHawkInstallableFor {
@ -122,8 +128,12 @@ in {
bizhawkAssemblies = asmsFromReleaseArtifacts."bizhawkAssemblies-${versionFrag}-bin"; bizhawkAssemblies = asmsFromReleaseArtifacts."bizhawkAssemblies-${versionFrag}-bin";
}; };
}) })
]) ]))
releaseFrags)); lib.concatLists
lib.listToAttrs
(lib.filterAttrs (name: value: lib.hasSuffix "-bin" name
|| isVersionAtLeast "2.6" value.hawkSourceInfo.version))
];
latestVersionFrag = lib.head releaseFrags; latestVersionFrag = lib.head releaseFrags;
combined = pp // asmsFromReleaseArtifacts // releasesEmuHawkInstallables // { combined = pp // asmsFromReleaseArtifacts // releasesEmuHawkInstallables // {
inherit depsForHistoricalRelease releaseTagSourceInfos; inherit depsForHistoricalRelease releaseTagSourceInfos;