2023-11-19 13:33:48 +00:00
{ lib
# infrastructure
2023-11-21 04:15:37 +00:00
, isVersionAtLeast
2023-11-19 13:33:48 +00:00
, replaceDotWithUnderscore
, fetchFromGitHub
, fetchFromGitLab
, mkNugetDeps
# makedeps
, dotnet-sdk_5
, dotnet-sdk_6
2024-02-12 20:38:03 +00:00
, dotnet-sdk_8
2023-11-19 13:33:48 +00:00
} : let
/* *
* 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 `
* /
2023-11-21 04:15:37 +00:00
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 "
] ;
2023-11-19 13:33:48 +00:00
releaseCount = lib . length releases ;
releaseFrags = builtins . map replaceDotWithUnderscore releases ;
releaseOffsetLookup = lib . listToAttrs ( lib . imap0 ( lib . flip lib . nameValuePair ) releaseFrags ) ;
depsForHistoricalRelease = releaseFrag : fetchNuGet : let
file = import ./deps-historical.nix ;
2023-11-21 04:15:37 +00:00
windows = builtins . map ( s : file . " s i n c e - ${ s } " or [ ] ) releaseFrags ++ builtins . map ( s : file . " u n t i l - ${ s } " or [ ] ) releaseFrags ;
extras = builtins . map ( s : file . " o n l y - ${ s } " or [ ] ) releaseFrags ;
2023-11-19 13:33:48 +00:00
i = releaseOffsetLookup . ${ releaseFrag } ;
in builtins . map fetchNuGet ( lib . elemAt extras i ++ lib . concatLists ( lib . sublist i releaseCount windows ) ) ;
releaseTagSourceInfos = let
f = { hashPostPatching , rev , version , postFetch ? " " , dotnet-sdk ? null }: let
shortHash = lib . substring 0 9 rev ;
fetcherArgs = {
inherit rev ;
repo = " B i z H a w k " ;
hash = hashPostPatching ;
postFetch = ''
shortHash = $ { shortHash }
'' + p o s t F e t c h ;
} ;
in ( lib . optionalAttrs ( dotnet-sdk != null ) { inherit dotnet-sdk ; } ) // {
inherit shortHash version ;
2023-11-21 04:15:37 +00:00
src = fetchFromGitHub ( fetcherArgs // { owner = " T A S E m u l a t o r s " ; } ) ;
2023-11-19 13:33:48 +00:00
#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)
2023-11-21 04:15:37 +00:00
src1 = fetchFromGitLab ( fetcherArgs // { owner = " T A S V i d e o s " ; } ) ;
2023-11-19 13:33:48 +00:00
nugetDeps = let
releaseFrag = replaceDotWithUnderscore version ;
in mkNugetDeps {
name = " B i z H a w k - ${ releaseFrag } - d e p s " ;
nugetDeps = { fetchNuGet }: depsForHistoricalRelease releaseFrag fetchNuGet ;
} ;
} ;
/* *
* ` $ ( . . . ) ` is literal here--these scripts invoke Git in subshells ,
* and we need to run them during the build without ` nativeBuildInputs = [ git ] ; `
* /
from-2_6_2-through-2_9-no-git-patch = ''
sed ' s / $ ( git rev-parse - - verify HEAD ) / ' " $ s h o r t H a s h " ' / ' - i $ out/Dist/.InvokeCLIOnMainSln.sh
'' ;
/* * d i t t o */
pre-2_9_1-no-git-patch = ''
sed - e ' s / $ ( git rev-parse - - abbrev-ref HEAD ) /master / ' \
- e ' s / $ ( git log -1 - - format = " % h " ) / ' " $ s h o r t H a s h " ' / ' \
- i $ out/Build/standin.sh
sed ' s / $ ( git rev-list HEAD - - count ) / ' " $ c o m m i t C o u n t " ' / ' - i $ out/Build/standin.sh
'' ;
in lib . mapAttrs ( _ : f ) {
info-2_9_1 = {
version = " 2 . 9 . 1 " ;
rev = " 7 4 5 e f b 1 d d 8 e b 8 2 f 3 1 b a 9 2 0 1 a 7 9 c d f c 5 b c a f 1 f 5 d 1 " ;
/* *
* ` $ ( . . . ) ` is literal here--this script invokes Git in a subshell ,
* and we need to run it during the build without ` nativeBuildInputs = [ git ] ; `
* ( though in this case the build would continue with the dummy value after printing an error )
* /
postFetch = ''
sed ' s / $ ( git rev-parse - - verify HEAD || printf " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " ) / ' " $ s h o r t H a s h " ' / ' \
- i $ out/Dist/.InvokeCLIOnMainSln.sh
'' ;
hashPostPatching = " s h a 2 5 6 - g 6 U 0 B + w Y 5 u o s P 5 W y N F K y l B R X 9 k q + z M 6 H + f 0 5 e g Y q c A Q = " ;
2024-02-12 20:38:03 +00:00
dotnet-sdk = dotnet-sdk_6 ;
2023-11-19 13:33:48 +00:00
} ;
info-2_9 = {
version = " 2 . 9 " ;
rev = " a c 3 a 8 c 7 e 5 f 0 7 1 1 b 5 1 d e f d b 3 f 1 2 1 d 1 a 6 3 c 4 4 8 1 8 c 3 " ;
postFetch = ''
commitCount = 20208
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h + f r o m - 2 _ 6 _ 2 - t h r o u g h - 2 _ 9 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - g D L S t q p R G x T l X i p + F K W j / O 7 s Q E l B N j Q K 8 H p j Z b X s r C 0 = " ;
2024-02-12 20:38:03 +00:00
dotnet-sdk = dotnet-sdk_6 ;
2023-11-19 13:33:48 +00:00
} ;
info-2_8 = {
version = " 2 . 8 " ;
rev = " e 7 3 1 e 0 f 3 2 9 0 3 c d 4 0 b 8 3 e d 7 5 b b a 3 b 1 e 3 7 5 3 1 0 5 c e 2 " ;
postFetch = ''
commitCount = 19337
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h + f r o m - 2 _ 6 _ 2 - t h r o u g h - 2 _ 9 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - T f x A A 8 Q k y I m a u 0 M x C d b T W F K n e X Z w p X Y P I B + i N 9 z + U n k = " ;
2024-02-12 20:38:03 +00:00
dotnet-sdk = dotnet-sdk_6 ;
2023-11-19 13:33:48 +00:00
} ;
info-2_7 = {
version = " 2 . 7 " ;
rev = " d b a f 2 5 9 5 6 2 5 f 7 9 0 9 3 e e e c 3 7 d 2 d 4 a 7 a 9 a 4 d 3 7 f 3 7 0 " ;
postFetch = ''
commitCount = 19020
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h + f r o m - 2 _ 6 _ 2 - t h r o u g h - 2 _ 9 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - I X 8 W m N U + g E Y 8 V h 6 O A C 3 X o g i G S m A f d A k s 4 H P J V t 4 K / 4 w = " ;
dotnet-sdk = dotnet-sdk_5 ;
} ;
info-2_6_3 = {
version = " 2 . 6 . 3 " ;
rev = " 1 6 7 b f e b 4 c 0 8 2 1 a c 0 6 6 a 0 0 6 2 3 3 1 4 9 e 2 e 3 c 5 b 0 d b e 0 " ;
postFetch = ''
commitCount = 18925
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h + f r o m - 2 _ 6 _ 2 - t h r o u g h - 2 _ 9 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - 2 + r 3 5 r V D N Y Q 1 s K f f j S p h + b s S W R t z 1 v 3 j g D q A i 5 W r h K o = " ;
dotnet-sdk = dotnet-sdk_5 ;
} ;
info-2_6_2 = {
version = " 2 . 6 . 2 " ;
rev = " c 5 e 6 a a d b 0 e 4 c f 6 9 7 3 8 5 d 2 9 c 2 a 4 8 1 a 3 a e 0 0 1 7 1 4 5 e " ;
postFetch = ''
commitCount = 18704
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h + f r o m - 2 _ 6 _ 2 - t h r o u g h - 2 _ 9 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - T P f 2 l F I 4 P r s w o P F Q A K r r 9 v Q P H Q 9 Q i 5 a f g P S y J E E r K u o = " ;
dotnet-sdk = dotnet-sdk_5 ;
} ;
info-2_6_1 = {
version = " 2 . 6 . 1 " ;
rev = " b d 3 1 7 7 3 d 9 e 4 4 e 6 9 8 f d 5 c 0 3 5 6 a 6 0 0 e 5 3 2 b 0 a 9 2 5 1 f " ;
postFetch = ''
commitCount = 18467
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - 2 + z I l H I E N z a k Z G x j S G f A 0 o w F R r 5 K 2 u 5 E a g x T b n K e V s w = " ;
dotnet-sdk = dotnet-sdk_5 ;
} ;
info-2_6 = {
version = " 2 . 6 " ;
rev = " 7 7 4 9 d 0 2 3 8 2 d 1 c 9 e 6 8 2 c b d 2 8 f f 3 d d 3 2 4 0 e 5 b 9 1 2 2 7 " ;
postFetch = ''
commitCount = 18376
'' + p r e - 2 _ 9 _ 1 - n o - g i t - p a t c h ;
hashPostPatching = " s h a 2 5 6 - k s w m N E N Y x u m Q l J d U K R Q c b 5 N i 5 + a X U q K x E n J 8 j X 5 O H Q 0 = " ;
dotnet-sdk = dotnet-sdk_5 ;
} ;
2023-11-21 04:15:37 +00:00
# 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 = " 2 1 a 4 7 6 2 0 0 e 7 6 e f 8 1 5 d 2 b b 6 6 d f f c 1 6 7 f 9 7 2 0 a 4 e b 9 " ;
hashPostPatching = " " ;
} ;
info-2_5_1 = {
version = " 2 . 5 . 1 " ;
rev = " f 1 0 4 8 0 7 1 9 3 b d 5 a 4 b f f d d 6 7 d 5 2 9 6 7 a b 8 4 4 0 3 8 7 7 5 e " ;
hashPostPatching = " " ;
} ;
info-2_5 = {
version = " 2 . 5 " ;
rev = " 5 b 9 3 e f 1 4 d c 6 1 3 4 1 7 e b 9 3 7 c 1 f 7 9 3 d d 2 d f b 8 5 1 d 7 1 7 " ;
hashPostPatching = " " ;
} ;
info-2_4_2 = {
version = " 2 . 4 . 2 " ;
rev = " 5 4 6 c c d a 9 1 8 9 e 3 4 6 8 4 0 9 0 9 3 5 0 e c a 8 b 1 f d c a d a d 0 8 1 " ;
hashPostPatching = " " ;
} ;
info-2_4_1 = {
version = " 2 . 4 . 1 " ;
rev = " 6 0 a 1 d d e a 5 e 4 7 7 5 f 3 b e 4 b d 4 1 7 d 5 3 c a c f 0 e b a 9 7 8 c 4 " ;
hashPostPatching = " " ;
} ;
info-2_4 = {
version = " 2 . 4 " ;
rev = " 1 6 f 5 d a 9 f 9 c 2 e 5 7 a c 7 a 8 b b 7 0 b 2 0 2 8 e 3 a 9 5 0 1 1 2 7 b 8 " ;
hashPostPatching = " " ;
} ;
info-2_3_3 = {
version = " 2 . 3 . 3 " ;
rev = " c 3 3 0 5 4 1 c 3 5 e 9 7 c 6 6 d f 3 1 d 1 6 1 6 a 6 9 9 2 7 c f 6 5 b f 3 1 8 " ;
hashPostPatching = " " ;
} ;
info-2_3_2 = {
version = " 2 . 3 . 2 " ;
rev = " 9 2 8 4 7 b 1 d 1 d 5 3 4 1 0 8 1 4 3 c f b f f 1 e 2 6 6 0 3 6 3 3 2 c 0 5 7 3 " ;
hashPostPatching = " " ;
} ;
2023-11-19 13:33:48 +00:00
} ;
in {
inherit depsForHistoricalRelease releaseFrags releaseTagSourceInfos ;
/* * c a l l e d b y ` b u i l d A s s e m b l i e s F o r ` i . e . i m m e d i a t e l y b e f o r e u s e o f a ` h a w k S o u r c e I n f o ` */
populateHawkSourceInfo = hawkSourceInfo : let
inherit ( hawkSourceInfo ) version ;
neededExtraManagedDepsApprox = [ " v i r t u " ]
2023-11-21 04:15:37 +00:00
++ lib . optionals ( isVersionAtLeast " 2 . 6 " version ) [ " h a w k Q u a n t i z e r " " i s o P a r s e r " ]
++ lib . optionals ( isVersionAtLeast " 2 . 6 . 2 " version ) [ " f l a t B u f f e r s G e n O u t p u t " " s r c G e n R e f l e c t i o n C a c h e " ]
++ lib . optionals ( ! isVersionAtLeast " 2 . 9 " version ) [ " f l a t B u f f e r s C o r e " " g o n g S h e l l " ]
++ lib . optionals ( isVersionAtLeast " 2 . 9 " version ) [ " b i z h a w k A n a l y z e r " " n l u a " ]
++ lib . optional ( isVersionAtLeast " 2 . 9 . 1 " version ) " s r c G e n V e r s i o n I n f o "
++ lib . optionals ( ! isVersionAtLeast " 2 . 9 . 2 " version ) [ " s l i m D X " " s y s t e m D a t a S q l i t e D r o p I n " ]
++ lib . optional ( isVersionAtLeast " 2 . 9 . 2 " version ) " s r c G e n S e t t i n g s U t i l "
2023-11-19 13:33:48 +00:00
;
in {
inherit neededExtraManagedDepsApprox ;
__contentAddressed = false ; #TODO try w/ CA
2023-11-21 04:15:37 +00:00
copyingAssetsInEmuHawkProj = isVersionAtLeast " 2 . 6 . 3 " version ;
2024-02-12 20:38:03 +00:00
dotnet-sdk = dotnet-sdk_8 ;
2023-11-21 04:15:37 +00:00
exePathRespectsEnvVar = isVersionAtLeast " 2 . 9 . 2 " version ;
hasAssemblyResolveHandler = isVersionAtLeast " 2 . 3 . 3 " version ;
hasAssetsInOutput = ! isVersionAtLeast " 2 . 6 . 1 " 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 ;
2023-11-19 13:33:48 +00:00
neededExtraManagedDeps = neededExtraManagedDepsApprox ;
2023-12-02 18:40:22 +00:00
needsLibGLVND = false ; # true iff not using nixGL (i.e. on NixOS) AND using the OpenGL renderer (the default option)
2023-11-21 04:15:37 +00:00
needsSDL = isVersionAtLeast " 2 . 9 . 2 " version ;
2023-11-19 13:33:48 +00:00
nugetDeps = ./deps.nix ;
2023-11-21 04:15:37 +00:00
packageScriptNeeds7Zip = ! isVersionAtLeast " 2 . 6 . 3 " version ;
packageScriptRemovesWinFilesFromLinux = isVersionAtLeast " 2 . 9 . 2 " version ;
pathConfigNeedsOrdinal = ! isVersionAtLeast " 2 . 7 . 1 " version ;
2023-11-19 13:33:48 +00:00
releaseArtifactHasRogueOTKAsmConfig = version == " 2 . 9 . 1 " ;
2023-11-21 04:15:37 +00:00
releaseArtifactNeedsLowercaseAsms = ! isVersionAtLeast " 2 . 3 . 3 " version ;
releaseArtifactNeedsOTKAsmConfig = isVersionAtLeast " 2 . 3 . 3 " version && ! isVersionAtLeast " 2 . 5 " version ; # see a1b501fe5
releaseArtifactNeedsVBDotnetReference = ! isVersionAtLeast " 2 . 5 . 1 " version ;
2023-11-25 14:56:06 +00:00
testProjectNeedsCIEnvVar = ! isVersionAtLeast " 2 . 8 " version ; # platform-specific tests don't run "in CI" because they assume Arch filesystem conventions (on Linux)--before 908d4519c, `-p:ContinuousIntegrationBuild=true` wasn't respected but `GITLAB_CI` was
2023-11-21 04:15:37 +00:00
versionProjNeedsDoubleBuild = ! isVersionAtLeast " 2 . 9 . 1 " version ;
2023-11-19 13:33:48 +00:00
#TODO warn about missing/broken features when eval'ing older releases
} // hawkSourceInfo ;
/* * t o b e p a s s e d t o ` s p l i t R e l e a s e A r t i f a c t ` */
releaseArtifactInfos = lib . mapAttrs'
( releaseFrag : value : {
name = " b i z h a w k A s s e m b l i e s - ${ releaseFrag } - b i n " ;
2023-11-21 04:15:37 +00:00
value = let
hawkSourceInfo = releaseTagSourceInfos . " i n f o - ${ releaseFrag } " // value . hawkSourceInfo or { } ;
in {
inherit hawkSourceInfo ;
$ { if isVersionAtLeast " 2 . 6 " hawkSourceInfo . version
then if isVersionAtLeast " 2 . 6 . 3 " hawkSourceInfo . version
then null
else " z i p p e d T a r b a l l "
else " c r o s s P l a t f o r m A r t i f a c t " } = true ;
} // lib . optionalAttrs ( ! isVersionAtLeast " 2 . 6 " hawkSourceInfo . version ) { stripRoot = false ; } // value ;
2023-11-19 13:33:48 +00:00
} )
{
" 2 _ 9 _ 1 " = {
stripRoot = false ;
hashPrePatching = " s h a 2 5 6 - 5 a K U b N S t Q 8 9 h n f a x v 7 M T Q + 1 q D f y + Q N M y L S 5 W U T d h u e 4 = " ;
} ;
" 2 _ 9 " = {
hashPrePatching = " s h a 2 5 6 - g E 0 i u 2 L 2 y v C 6 d x B c v 9 F a c m 8 R K P p 9 d s e D 7 f A H 3 f n a Z s Y = " ;
} ;
" 2 _ 8 " = {
stripRoot = false ;
hashPrePatching = " s h a 2 5 6 - I R b h I 2 2 l 3 0 O P n 8 z J 4 H P e m j W U o h U v Z S t l E Y K n V 7 R A r F A = " ;
} ;
" 2 _ 7 " = {
hashPrePatching = " s h a 2 5 6 - r c 9 T k 5 P c 4 p 6 Y R 3 3 c o w B 9 W 0 1 i R l 8 F Y g A I / V 1 C H c + p L 5 E = " ;
} ;
" 2 _ 6 _ 3 " = {
stripRoot = false ;
hashPrePatching = " s h a 2 5 6 - g C H y S f N O j q a z b Q D q k 5 l K J I Y m P I 6 o n q c a V D w u Y 8 U d 2 n s = " ;
} ;
" 2 _ 6 _ 2 " = {
hashPrePatching = " s h a 2 5 6 - t l n F / Z Q O k L M b i E V 2 B q h x z Q / K i x G Z 3 0 + L g O U o H v p v 1 3 s = " ;
} ;
" 2 _ 6 _ 1 " = {
hashPrePatching = " s h a 2 5 6 - O u 4 N b R o 7 G h 0 H W v i X S E H t p 0 P p s G D d Y s N 8 y h R 0 / g Q y 3 r Y = " ;
} ;
" 2 _ 6 " = {
hashPrePatching = " s h a 2 5 6 - A H P 1 m g e d C 9 w U q + Y A J D 0 g M 4 L r l 0 H 0 U k r W y i f E D C 9 K L o g = " ;
} ;
2023-11-21 04:15:37 +00:00
" 2 _ 5 _ 2 " = {
hashPrePatching = " s h a 2 5 6 - v u r A H O S W w p H Z 9 6 c L n R v b 6 w R + 6 d v T V K g o q U v l U 4 Q y p 3 g = " ;
} ;
" 2 _ 5 _ 1 " = {
hashPrePatching = " s h a 2 5 6 - t B 6 U X Q P F H P I h V 5 b E R k v / k A k t y M n 3 d n l I 4 n z I w X O 9 i m Q = " ;
} ;
" 2 _ 5 " = {
url = " h t t p s : / / g i t h u b . c o m / T A S E m u l a t o r s / B i z H a w k / r e l e a s e s / d o w n l o a d / 2 . 5 / B i z H a w k - 2 . 5 . 0 . z i p " ;
hashPrePatching = " s h a 2 5 6 - O P u N x g H W Y B C w 6 g k k l l i r 0 U 9 z + Z F 3 K 8 K 2 o 2 4 W 0 0 M W g L k = " ;
} ;
" 2 _ 4 _ 2 " = {
hashPrePatching = " s h a 2 5 6 - 0 Z u n z B T O 4 O + B 8 9 N 5 P I 0 + A e V F B h e 9 s h E t C A N s Y J B V d a Y = " ;
} ;
" 2 _ 4 _ 1 " = {
hashPrePatching = " s h a 2 5 6 - u O R U D s P h 7 e P R z B 6 9 w q K W 6 5 C c h 3 5 F j g 3 4 Q 0 a a 7 V c f + d A = " ;
} ;
" 2 _ 4 " = {
hashPrePatching = " s h a 2 5 6 - v g o c Y t 0 W o 5 L S L x H F 5 W 1 a F i 2 x q k k l M Y h Z P 4 z H O I F b C b 0 = " ;
} ;
" 2 _ 3 _ 3 " = {
hashPrePatching = " s h a 2 5 6 - k L P N p n g g n r c 7 T g A 6 N C C 0 P / t k F i U g T H V y K P d U z 0 U X 1 E E = " ;
} ;
" 2 _ 3 _ 2 " = {
hashPrePatching = " s h a 2 5 6 - x 2 D w r z B k P A G h l o v / e U / V w X u H V P / R v 0 o 7 p Z p t m s S Q L J U = " ;
} ;
# older releases won't pass prereq checker w/o WINE libs, relevant change was https://github.com/TASEmulators/BizHawk/commit/27a4062ea22e5cb4a81628580ce47fec7a2709a5#diff-aff17d6fcf6169cad48e9c8d08145b0de360e874aa8ffee0ea66e636cccda39f
2023-11-19 13:33:48 +00:00
} ;
2023-11-20 02:22:33 +00:00
}