dwarf-fortress: fix eval on darwin

This commit is contained in:
Morgan Jones 2024-06-03 23:24:09 -07:00
parent d2111b0cbb
commit 880bea37bd
No known key found for this signature in database
GPG Key ID: 52BAC54ED447974E
3 changed files with 8 additions and 6 deletions

View File

@ -49,7 +49,9 @@ let
# The latest Dwarf Fortress version. Maintainers: when a new version comes
# out, ensure that (unfuck|dfhack|twbt) are all up to date before changing
# this. Note that unfuck and twbt are not required for 50.
latestVersion = "50.13";
latestVersion = if stdenv.isLinux then "50.13"
else if stdenv.isDarwin then "0.47.05"
else throw "Unsupported system";
# Converts a version to a package name.
versionToName = version: "dwarf-fortress_${replaceStrings ["."] ["_"] version}";
@ -62,7 +64,7 @@ let
let
isAtLeast50 = versionAtLeast dfVersion "50.0";
dwarf-fortress-unfuck = optionalAttrs (!isAtLeast50) (callPackage ./unfuck.nix { inherit dfVersion; });
dwarf-fortress-unfuck = optionalAttrs (!isAtLeast50 && stdenv.isLinux) (callPackage ./unfuck.nix { inherit dfVersion; });
dwarf-fortress = callPackage ./game.nix {
inherit dfVersion;

View File

@ -53,7 +53,7 @@ let
patchVersion = elemAt dfVersionTuple (dfVersionBaseIndex + 1);
isAtLeast50 = baseVersion >= 50;
enableUnfuck = !isAtLeast50 && dwarf-fortress-unfuck != null;
enableUnfuck = !isAtLeast50 && dwarf-fortress-unfuck != null && (dwarf-fortress-unfuck.dfVersion or null) == dfVersion;
game =
if hasAttr dfVersion df-hashes
@ -95,7 +95,7 @@ stdenv.mkDerivation {
fi
'';
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = optional stdenv.isLinux autoPatchelfHook;
buildInputs = optionals isAtLeast50 [ SDL2 SDL2_image SDL2_mixer ]
++ optional (!isAtLeast50) SDL
++ optional enableUnfuck dwarf-fortress-unfuck

View File

@ -197,8 +197,8 @@ stdenv.mkDerivation rec {
chmod 755 $out/bin/soundsense
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ expect xvfb-run ];
doInstallCheck = stdenv.isLinux;
nativeInstallCheckInputs = lib.optionals stdenv.isLinux [ expect xvfb-run ];
installCheckPhase = let
commonExpectStatements = fmod: lib.optionalString isAtLeast50 ''