mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-20 15:41:16 +00:00
openrct2: refactor assets for overrideAttrs support
This commit is contained in:
@@ -40,29 +40,6 @@
|
||||
rct2Path ? null,
|
||||
}:
|
||||
|
||||
let
|
||||
objects-version = "1.7.10";
|
||||
openmusic-version = "1.6.1";
|
||||
opensfx-version = "1.0.6";
|
||||
title-sequences-version = "0.4.26";
|
||||
|
||||
objects = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/objects/releases/download/v${objects-version}/objects.zip";
|
||||
hash = "sha256-9IO+Jm3CIHe6hRe78y/+OIw1Q7LuWF4K+9QQLbRSgCE=";
|
||||
};
|
||||
openmusic = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/OpenMusic/releases/download/v${openmusic-version}/openmusic.zip";
|
||||
hash = "sha256-mUs1DTsYDuHLlhn+J/frrjoaUjKEDEvUeonzP6id4aE=";
|
||||
};
|
||||
opensfx = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${opensfx-version}/opensound.zip";
|
||||
hash = "sha256-BrkPPhnCFnUt9EHVUbJqnj4bp3Vb3SECUEtzv5k2CL4=";
|
||||
};
|
||||
title-sequences = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/title-sequences/releases/download/v${title-sequences-version}/title-sequences.zip";
|
||||
hash = "sha256-2ruXh7FXY0L8pN2fZLP4z6BKfmzpwruWEPR7dikFyFg=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "openrct2";
|
||||
version = "0.5.3";
|
||||
@@ -77,6 +54,34 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-my7fPBD5N0bO1yPaxwHUFqw6TvayQs10kcAX/NqPpIg=";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
|
||||
objects-version = "1.7.10";
|
||||
openmusic-version = "1.6.1";
|
||||
opensfx-version = "1.0.6";
|
||||
title-sequences-version = "0.4.26";
|
||||
|
||||
assets = {
|
||||
objects = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/objects/releases/download/v${finalAttrs.passthru.objects-version}/objects.zip";
|
||||
hash = "sha256-9IO+Jm3CIHe6hRe78y/+OIw1Q7LuWF4K+9QQLbRSgCE=";
|
||||
};
|
||||
openmusic = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/OpenMusic/releases/download/v${finalAttrs.passthru.openmusic-version}/openmusic.zip";
|
||||
hash = "sha256-mUs1DTsYDuHLlhn+J/frrjoaUjKEDEvUeonzP6id4aE=";
|
||||
};
|
||||
opensfx = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${finalAttrs.passthru.opensfx-version}/opensound.zip";
|
||||
hash = "sha256-BrkPPhnCFnUt9EHVUbJqnj4bp3Vb3SECUEtzv5k2CL4=";
|
||||
};
|
||||
title-sequences = fetchurl {
|
||||
url = "https://github.com/OpenRCT2/title-sequences/releases/download/v${finalAttrs.passthru.title-sequences-version}/title-sequences.zip";
|
||||
hash = "sha256-2ruXh7FXY0L8pN2fZLP4z6BKfmzpwruWEPR7dikFyFg=";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
@@ -122,25 +127,21 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
postUnpack = ''
|
||||
mkdir -p $sourceRoot/data/{object,sequence}
|
||||
unzip -o ${objects} -d $sourceRoot/data/object
|
||||
unzip -o ${openmusic} -d $sourceRoot/data
|
||||
unzip -o ${opensfx} -d $sourceRoot/data
|
||||
unzip -o ${title-sequences} -d $sourceRoot/data/sequence
|
||||
unzip -o ${finalAttrs.passthru.assets.objects} -d $sourceRoot/data/object
|
||||
unzip -o ${finalAttrs.passthru.assets.openmusic} -d $sourceRoot/data
|
||||
unzip -o ${finalAttrs.passthru.assets.opensfx} -d $sourceRoot/data
|
||||
unzip -o ${finalAttrs.passthru.assets.title-sequences} -d $sourceRoot/data/sequence
|
||||
'';
|
||||
|
||||
preConfigure =
|
||||
# Verify that the correct version of each third party repository is used.
|
||||
(
|
||||
let
|
||||
versionCheck = assetKey: url: ''
|
||||
grep -qF '"${url}"' assets.json \
|
||||
|| (echo "${assetKey} differs from expected version!"; exit 1)
|
||||
'';
|
||||
in
|
||||
(versionCheck "objects" objects.url)
|
||||
+ (versionCheck "openmusic" openmusic.url)
|
||||
+ (versionCheck "opensfx" opensfx.url)
|
||||
+ (versionCheck "title-sequences" title-sequences.url)
|
||||
lib.concatStringsSep "\n" (
|
||||
lib.mapAttrsToList (assetName: asset: ''
|
||||
grep -qF '"${asset.url}"' assets.json \
|
||||
|| (echo "${assetName} differs from expected version!"; exit 1)
|
||||
'') finalAttrs.passthru.assets
|
||||
)
|
||||
);
|
||||
|
||||
doInstallCheck = true;
|
||||
@@ -151,8 +152,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
${lib.optionalString (rct2Path != null) "--add-flags '--rct2-data-path=\"${rct2Path}\"'"}
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = {
|
||||
description = "Open source re-implementation of RollerCoaster Tycoon 2";
|
||||
longDescription = ''
|
||||
|
||||
Reference in New Issue
Block a user