Nix expr: Refactor how `custombuild.txt` is set declaratively

This commit is contained in:
YoshiRulz 2024-07-29 21:00:59 +10:00
parent 8e9e9b9218
commit 92f762b0c0
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 8 additions and 6 deletions

View File

@ -224,7 +224,11 @@ in {
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 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
versionProjNeedsDoubleBuild = !isVersionAtLeast "2.9.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 // {
frontendPackageFlavour = if (hawkSourceInfo.frontendPackageFlavour or null) == null
then "NixHawk"
else hawkSourceInfo.frontendPackageFlavour;
};
/** to be passed to `splitReleaseArtifact` */ /** to be passed to `splitReleaseArtifact` */
releaseArtifactInfos = lib.mapAttrs' releaseArtifactInfos = lib.mapAttrs'
(releaseFrag: value: { (releaseFrag: value: {

View File

@ -28,7 +28,6 @@
# other parameters # other parameters
, buildConfig , buildConfig
, doCheck , doCheck
, emuhawkBuildFlavour
, extraDefines , extraDefines
, extraDotnetBuildFlags , extraDotnetBuildFlags
}: let }: let
@ -163,7 +162,7 @@
'' else ""}mkdir -p $out; cp -avt $out packaged_output/*.exe* packaged_output/dll '' else ""}mkdir -p $out; cp -avt $out packaged_output/*.exe* packaged_output/dll
mv -t $out/dll $assets/dll/* mv -t $out/dll $assets/dll/*
mv -t $out $assets/defctrl.json $assets/gamedb $assets/Shaders mv -t $out $assets/defctrl.json $assets/gamedb $assets/Shaders
printf '${emuhawkBuildFlavour}' >$out/dll/custombuild.txt printf '${hawkSourceInfo.frontendPackageFlavour}' >$out/dll/custombuild.txt
runHook postInstall runHook postInstall
''; '';
@ -290,7 +289,7 @@ in {
${if hawkSourceInfo'.releaseArtifactNeedsVBDotnetReference then ''cp -t $out/dll '${lib.getOutput "out" monoBasic}/usr/lib/mono/4.5/Microsoft.VisualBasic.dll' ${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'.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 ""}${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 '' else ""}printf '${hawkSourceInfo'.frontendPackageFlavour}' >$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

@ -64,7 +64,6 @@ in {
, debugPInvokes ? false # forwarded to Dist/launch-scripts.nix , debugPInvokes ? false # forwarded to Dist/launch-scripts.nix
, debugDotnetHostCrashes ? false # forwarded to Dist/launch-scripts.nix , debugDotnetHostCrashes ? false # forwarded to Dist/launch-scripts.nix
, doCheck ? true # runs `Dist/BuildTest${buildConfig}.sh` , doCheck ? true # runs `Dist/BuildTest${buildConfig}.sh`
, emuhawkBuildFlavour ? "NixHawk"
, extraDefines ? "" # added to `<DefineConstants/>`, so ';'-separated , extraDefines ? "" # added to `<DefineConstants/>`, so ';'-separated
, extraDotnetBuildFlags ? "" # currently passed to EVERY `dotnet build` and `dotnet test` invocation (and does not replace the flags for parallel compilation added by default) , extraDotnetBuildFlags ? "" # currently passed to EVERY `dotnet build` and `dotnet test` invocation (and does not replace the flags for parallel compilation added by default)
, forNixOS ? true , forNixOS ? true
@ -111,7 +110,7 @@ in {
releaseTagSourceInfos runCommand symlinkJoin writeShellScriptBin releaseTagSourceInfos runCommand symlinkJoin writeShellScriptBin
git git
libgdiplus libGL lua openal SDL2 udev zstd libgdiplus libGL lua openal SDL2 udev zstd
buildConfig doCheck emuhawkBuildFlavour extraDefines extraDotnetBuildFlags; buildConfig doCheck 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 isVersionAtLeast "6.12.0.151" pkgs.mono.version else if isVersionAtLeast "6.12.0.151" pkgs.mono.version