diff --git a/pkgs/by-name/op/openomf/package.nix b/pkgs/by-name/op/openomf/package.nix index 4afd2412cbc0..bed3b3f12465 100644 --- a/pkgs/by-name/op/openomf/package.nix +++ b/pkgs/by-name/op/openomf/package.nix @@ -6,7 +6,6 @@ cmake, argtable, enet, - git, libconfuse, libnatpmp, libepoxy, @@ -18,7 +17,8 @@ SDL2_mixer, unzip, zlib, - withRemix ? true, + nix-update-script, + versionCheckHook, }: let @@ -30,25 +30,42 @@ let url = "https://www.omf2097.com/pub/files/omf/openomf-icons.zip"; hash = "sha256-8LWmrkY3ZiXcuVe0Zj90RQFUTwM27dJ4ev9TiBGoVk0="; }; - remix = fetchurl { - url = "https://github.com/omf2097/openomf/releases/download/0.8.0/ARENA2.ogg"; - hash = "sha256-jOIzDaIwQDlwCaPrRZdG5Y0g7bWKwc38mPKP030PGb4="; + musicRemixes = fetchurl { + url = "https://github.com/omf2097/openomf-music-mod/releases/download/1.0/openomf-mods-1.0.zip"; + hash = "sha256-uiaM6n+dDcTeBNNnypEWXPNG8Xac1JQXCTfVkORfvi0="; }; in stdenv.mkDerivation (finalAttrs: { pname = "openomf"; - version = "0.8.5"; + version = "0.8.6"; + + __structuredAttrs = true; + strictDeps = true; src = fetchFromGitHub { owner = "omf2097"; repo = "openomf"; tag = finalAttrs.version; - hash = "sha256-5X8drQKMwYZ5M/i7hxyI25AysQGedQ5BLEYcNXWHgNk="; + hash = "sha256-KzT2leU52nxUIsuiVM5soWmi+x1LStdxY5JLoCkSSb8="; }; + postPatch = '' + # TODO: Take this upstream + substituteInPlace cmake-scripts/version.cmake \ + --replace-fail "set(VERSION_MAJOR 0)" "set(VERSION_MAJOR ${lib.versions.major finalAttrs.version})" \ + --replace-fail "set(VERSION_MINOR 0)" "set(VERSION_MINOR ${lib.versions.minor finalAttrs.version})" \ + --replace-fail "set(VERSION_PATCH 0)" "set(VERSION_PATCH ${lib.versions.patch finalAttrs.version})" \ + --replace-fail "set(VERSION_LABEL)" "set(VERSION_LABEL) + return()" + + substituteInPlace src/resources/resource_paths.c \ + --replace-fail \ + "/usr/local/share/games:/usr/share/games:/usr/local/share:/usr/share" \ + "$out/share/games" + ''; + nativeBuildInputs = [ cmake - git unzip ]; @@ -69,20 +86,39 @@ stdenv.mkDerivation (finalAttrs: { postInstall = '' mkdir -p $out/share/icons/hicolor/256x256/apps - unzip -j ${assets} -d $out/share/games/openomf + + unzip -j ${assets} -d $out/share/games/openomf/resources + + unzip ${musicRemixes} -d $out/share/games/openomf/mods + unzip -p ${icons} omf-logo/omf-256x256.png > $out/share/icons/hicolor/256x256/apps/org.openomf.OpenOMF.png install -Dm644 $src/resources/flatpak/org.openomf.OpenOMF.desktop $out/share/applications/org.openomf.OpenOMF.desktop - '' - + lib.optionalString withRemix '' - ln -s ${remix} $out/share/games/openomf/ARENA2.ogg - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p $out/resources - ln -s $out/share/games/openomf/* $out/resources ''; + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + passthru.updateScript = nix-update-script { }; + meta = { description = "One Must Fall 2097 Remake"; + longDescription = '' + OpenOMF is an open-source remake of the 1994 DOS fighting game One Must + Fall 2097 by Diversions Entertainment. It reimplements the original + engine from scratch, uses the original (now freeware) game assets, and + adds modern conveniences such as online netplay. + + Includes remixed music mod. To add other mods: drop its .zip file + into the user mods directory as-is; it does not need to be extracted. + + The user mods directory is /mods, where is resolved at + launch in the following order. + + 1. $OPENOMF_STATE_PATH, if set + 2. $XDG_STATE_HOME, if set + (e.g. ~/.local/state, giving ~/.local/state/mods) + 3. SDL's preference path, ~/.local/share/OpenOMF/mods + ''; homepage = "https://www.openomf.org"; changelog = "https://github.com/omf2097/openomf/releases/tag/${finalAttrs.version}/CHANGELOG.md"; license = lib.licenses.mit;