uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,84 @@
/* The reusable code, and package attributes, between OpenRA engine packages (engine.nix)
and out-of-tree mod packages (mod.nix).
*/
{ lib, makeSetupHook, curl, unzip, dos2unix, pkg-config, makeWrapper
, lua, mono, dotnetPackages, python2
, libGL, freetype, openal, SDL2
, zenity
}:
with lib;
let
path = makeBinPath ([ mono python2 ] ++ optional (zenity != null) zenity);
rpath = makeLibraryPath [ lua freetype openal SDL2 ];
mkdirp = makeSetupHook { } ./mkdirp.sh;
in {
patchEngine = dir: version: ''
sed -i \
-e 's/^VERSION.*/VERSION = ${version}/g' \
-e '/fetch-geoip-db/d' \
-e '/GeoLite2-Country.mmdb.gz/d' \
${dir}/Makefile
sed -i 's|locations=.*|locations=${lua}/lib|' ${dir}/thirdparty/configure-native-deps.sh
'';
wrapLaunchGame = openraSuffix: ''
# Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542
# https://github.com/mono/mono/issues/6752#issuecomment-365212655
wrapProgram $out/lib/openra${openraSuffix}/launch-game.sh \
--prefix PATH : "${path}" \
--prefix LD_LIBRARY_PATH : "${rpath}" \
--set TERM xterm
makeWrapper $out/lib/openra${openraSuffix}/launch-game.sh $(mkdirp $out/bin)/openra${openraSuffix} \
--chdir "$out/lib/openra${openraSuffix}"
'';
packageAttrs = {
buildInputs = with dotnetPackages; [
FuzzyLogicLibrary
MaxMindDb
MaxMindGeoIP2
MonoNat
NewtonsoftJson
NUnit3
NUnitConsole
OpenNAT
RestSharp
SharpFont
SharpZipLib
SmartIrc4net
StyleCopMSBuild
StyleCopPlusMSBuild
] ++ [
libGL
];
# TODO: Test if this is correct.
nativeBuildInputs = [
curl
unzip
dos2unix
pkg-config
makeWrapper
mkdirp
mono
python2
];
makeFlags = [ "prefix=$(out)" ];
doCheck = true;
dontStrip = true;
meta = {
maintainers = with maintainers; [ fusion809 msteen rardiol ];
license = licenses.gpl3;
platforms = platforms.linux;
};
};
}

View file

@ -0,0 +1,71 @@
/* This file defines all OpenRA packages under `openraPackages`,
e.g. the OpenRA release engine can be found at `openraPackages.engines.release` (see `engines.nix`),
or the out-of-tree mod "Combined Arms" can be found at `openraPackages.mods.ca` (see `mods.nix`).
The `openra` package is just an alias to `openraPackages.engines.release`,
and just provides the mods included in the source code of the engine.
Additional engines or mods can be added with `openraPackages.buildOpenRAEngine` (function around `engine.nix`)
and `openraPackages.buildOpenRAMod` (function around `mod.nix`), respectively.
*/
pkgs:
with pkgs.lib;
let
/* Building an engine or out-of-tree mod is very similar,
but different enough not to be able to build them with the same package definition,
so instaed we define what is common between them in a seperate file.
Although `callPackage` could be used, it would require undoing `makeOverridable`,
because `common.nix` does not define a package, but just an attribute set,
which is directly passed as part of the argument to the engines and mods `callPackage`,
so either the attributes added by `makeOverridable` have to be removed
or the engine and mod package definitions will need to add `...` to the argument list.
*/
common = let f = import ./common.nix; in f (builtins.intersectAttrs (functionArgs f) pkgs // {
lua = pkgs.lua5_1;
# It is not necessary to run the game, but it is nicer to be given an error dialog in the case of failure,
# rather than having to look to the logs why it is not starting.
inherit (pkgs.gnome) zenity;
});
/* Building a set of engines or mods requires some dependencies as well,
so the sets will actually be defined as a function instead,
requiring the dependencies and returning the actual set.
Not all dependencies for defining a engine or mod set are shared,
so additional arguments can be passed as well.
The builders for engines and mods allow to delay specifying the name,
by returning a function that expects a name, which we use, in this case,
to base the name on the attribute name instead, preventing the need to specify the name twice
if the attribute name and engine/mod name are equal.
*/
callWithName = name: value: if isFunction value then value name else value;
buildOpenRASet = f: args: pkgs.recurseIntoAttrs (mapAttrs callWithName (f ({
inherit (pkgs) fetchFromGitHub;
postFetch = ''
sed -i 's/curl/curl --insecure/g' $out/thirdparty/{fetch-thirdparty-deps,noget}.sh
$out/thirdparty/fetch-thirdparty-deps.sh
'';
} // args)));
in pkgs.recurseIntoAttrs rec {
# The whole attribute set is destructered to ensure those (and only those) attributes are given
# and to provide defaults for those that are optional.
buildOpenRAEngine = { name ? null, version, description, homepage, mods, src }@engine:
# Allow specifying the name at a later point if no name has been given.
let builder = name: pkgs.callPackage ./engine.nix (common // {
engine = engine // { inherit name; };
}); in if name == null then builder else builder name;
# See `buildOpenRAEngine`.
buildOpenRAMod = { name ? null, version, title, description, homepage, src, engine, assetsError ? "" }@mod: ({ version, mods ? [], src }@engine:
let builder = name: pkgs.callPackage ./mod.nix (common // {
mod = mod // { inherit name assetsError; };
engine = engine // { inherit mods; };
}); in if name == null then builder else builder name) engine;
# See `buildOpenRASet`.
engines = buildOpenRASet (import ./engines.nix) { inherit buildOpenRAEngine; };
mods = buildOpenRASet (import ./mods.nix) { inherit buildOpenRAMod; };
}

View file

@ -0,0 +1,59 @@
/* The package defintion for an OpenRA engine.
It shares code with `mod.nix` by what is defined in `common.nix`.
Similar to `mod.nix` it is a generic package definition,
in order to make it easy to define multiple variants of the OpenRA engine.
For each mod provided by the engine, a wrapper script is created,
matching the naming convention used by `mod.nix`.
This package could be seen as providing a set of in-tree mods,
while the `mod.nix` pacakges provide a single out-of-tree mod.
*/
{ lib, stdenv
, packageAttrs
, patchEngine
, wrapLaunchGame
, engine
}:
with lib;
stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
pname = "openra";
version = "${engine.name}-${engine.version}";
src = engine.src;
postPatch = patchEngine "." version;
configurePhase = ''
runHook preConfigure
make version VERSION=${escapeShellArg version}
runHook postConfigure
'';
buildFlags = [ "DEBUG=false" "default" "man-page" ];
checkTarget = "nunit test";
installTargets = [
"install"
"install-linux-icons"
"install-linux-desktop"
"install-linux-appdata"
"install-linux-mime"
"install-man-page"
];
postInstall = ''
${wrapLaunchGame ""}
${concatStrings (map (mod: ''
makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
'') engine.mods)}
'';
meta = {
inherit (engine) description homepage;
};
})

View file

@ -0,0 +1,41 @@
{ buildOpenRAEngine, fetchFromGitHub, postFetch }:
let
buildUpstreamOpenRAEngine = { version, rev, sha256 }: name: (buildOpenRAEngine {
inherit version;
description = "Open-source re-implementation of Westwood Studios' 2D Command and Conquer games";
homepage = "https://www.openra.net/";
mods = [ "cnc" "d2k" "ra" "ts" ];
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA" ;
inherit rev sha256 postFetch;
};
} name).overrideAttrs (origAttrs: {
postInstall = ''
${origAttrs.postInstall}
cp -r mods/ts $out/lib/openra/mods/
cp mods/ts/icon.png $(mkdirp $out/share/pixmaps)/openra-ts.png
( cd $out/share/applications; sed -e 's/Dawn/Sun/g' -e 's/cnc/ts/g' openra-cnc.desktop > openra-ts.desktop )
'';
});
in {
release = name: (buildUpstreamOpenRAEngine rec {
version = "20190314";
rev = "${name}-${version}";
sha256 = "15pvn5cx3g0nzbrgpsfz8dngad5wkzp5dz25ydzn8bmxafiijvcr";
} name);
playtest = name: (buildUpstreamOpenRAEngine rec {
version = "20190302";
rev = "${name}-${version}";
sha256 = "1vqvfk2p2lpk3m0d3rpvj34i8cmk3mfc7w4cn4llqd9zp4kk9pya";
} name);
bleed = buildUpstreamOpenRAEngine {
version = "8ee1102";
rev = "8ee11028d72cde7556b31d45f556b40be65b4b70";
sha256 = "0f1fpf37ms8d7fhlh3rjzsxsk9w23iyi3phs2i7g561292d5rk3l";
};
}

View file

@ -0,0 +1,4 @@
mkdirp() {
mkdir -p "$@"
echo "$@"
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
show_error() {
if command -v zenity > /dev/null; then
zenity --no-wrap --no-markup --error --title "OpenRA - @title@" --text "$1" 2>/dev/null
else
printf "$1\n" >&2
fi
exit 1
}
cd "@out@/lib/openra-@name@"
# Check for missing assets
assetsError='@assetsError@'
if [[ -n "$assetsError" && ! -d "$HOME/.openra/Content/@name@" ]]; then
show_error "$assetsError"
fi
# Run the game
mono --debug OpenRA.Game.exe Game.Mod=@name@ Engine.LaunchPath="@out@/bin/openra-@name@" Engine.ModSearchPaths="@out@/lib/openra-@name@/mods" "$@"
# Show a crash dialog if something went wrong
if (( $? != 0 && $? != 1 )); then
show_error $'OpenRA - @title@ has encountered a fatal error.\nPlease refer to the crash logs for more information.\n\nLog files are located in ~/.openra/Logs'
fi

160
pkgs/games/openra/mod-update.sh Executable file
View file

@ -0,0 +1,160 @@
#!/usr/bin/env bash
# shellcheck disable=SC2034
# for mod in $(nix eval --raw '(
# with import <nixpkgs> { };
# with lib;
# let mods = attrNames (removeAttrs openraPackages.mods [ "recurseForDerivations" ]);
# in concatStringsSep " " mods
# )'); do
# ./mod-update.sh "$mod"
# done
# Uses: https://github.com/msteen/nix-upfetch
mod=$1
commit_count=$2
token=
nixpkgs='<nixpkgs>'
die() {
local ret=$?
echo "$*" >&2
exit $ret
}
curl() {
command curl --silent --show-error "$@"
}
get_sha1() {
local owner=$1 repo=$2 ref=$3
# https://developer.github.com/v3/#authentication
curl -H "Authorization: token $token" -H 'Accept: application/vnd.github.VERSION.sha' "https://api.github.com/repos/$owner/$repo/commits/$ref"
}
[[ -n $mod ]] || die "The first argument of this script has to be a mod identifier."
[[ -n $token ]] || die "Please edit this script to include a GitHub API access token, which is required for API v4:
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/"
# Get current mod_owner and mod_repo.
vars=$(nix-prefetch --file "$nixpkgs" "openraPackages.mods.$mod" --index 0 --quiet --output json --no-compute-hash > >(
jq --raw-output 'with_entries(select(.value | contains("\n") | not)) | to_entries | .[] | .key + "=" + .value')) || exit
mod_owner=; mod_repo=; mod_rev=
while IFS='=' read -r key val; do
declare "mod_${key}=${val}"
done <<< "$vars"
if [[ -n $commit_count ]]; then
query_on_commit='{
history(first: 10) {
nodes {
abbreviatedOid
oid
}
totalCount
}
}'
else
query_on_commit='{
history(first: 0) {
totalCount
}
abbreviatedOid
oid
}'
fi
# shellcheck disable=SC2089
query='{
repository(owner: "'$mod_owner'", name: "'$mod_repo'") {
defaultBranchRef {
target {
... on Commit '$query_on_commit'
}
}
licenseInfo {
key
}
}
}'
# Newlines are not allowed in a query.
# https://developer.github.com/v4/guides/forming-calls/#communicating-with-graphql
# shellcheck disable=SC2086 disable=SC2090 disable=SC2116
query=$(echo $query)
query=${query//\"/\\\"}
# https://developer.github.com/v4/guides/using-the-explorer/#configuring-graphiql
json=$(curl -H "Authorization: bearer $token" -X POST -d '{ "query": "'"$query"'" }' https://api.github.com/graphql) || exit
if [[ -n $commit_count ]]; then
json=$(jq "$commit_count"' as $commit_count
| .data.repository.defaultBranchRef.target
|= (.history |= (. | del(.nodes) | .totalCount = $commit_count))
+ (.history | .nodes[.totalCount - $commit_count])' <<< "$json") || exit
fi
vars=$(jq --raw-output '.data.repository | {
license_key: .licenseInfo.key,
} + (.defaultBranchRef.target | {
version: ((.history.totalCount | tostring) + ".git." + .abbreviatedOid),
rev: .oid,
}) | to_entries | .[] | .key + "=" + (.value | tostring)' <<< "$json") || exit
mod_license_key=; mod_version=; mod_rev=
while IFS='=' read -r key val; do
declare "mod_${key}=${val}"
done <<< "$vars"
mod_config=$(curl "https://raw.githubusercontent.com/$mod_owner/$mod_repo/$mod_rev/mod.config") || exit
mod_id=; engine_version=; automatic_engine_management=; automatic_engine_source=
while IFS='=' read -r key val; do
declare "${key,,}=$(jq --raw-output . <<< "$val")"
done < <(grep '^\(MOD_ID\|ENGINE_VERSION\|AUTOMATIC_ENGINE_MANAGEMENT\|AUTOMATIC_ENGINE_SOURCE\)=' <<< "$mod_config")
for var in mod_id engine_version automatic_engine_management automatic_engine_source; do
echo "$var=${!var}" >&2
done
echo >&2
[[ $mod_id == "$mod" ]] ||
die "The mod '$mod' reports being mod '$mod_id' instead."
# shellcheck disable=SC2005 disable=SC2046
[[ $mod_license_key == gpl-3.0 ]] ||
[[ $(echo $(head -2 <(curl "https://raw.githubusercontent.com/$mod_owner/$mod_repo/$mod_rev/COPYING"))) == 'GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007' ]] ||
die "The mod '$mod' is licensed under '$mod_license_key' while expecting 'gpl-3.0'."
[[ $automatic_engine_management == True ]] ||
die "The mod '$mod' engine is not managed as a read-only dependency."
[[ $automatic_engine_source =~ https://github.com/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/archive/([a-zA-Z0-9_\-\$\{\}]+).zip ]] ||
die "The mod '$mod' engine is not hosted on GitHub as an archive."
engine_owner=${BASH_REMATCH[1]}
engine_repo=${BASH_REMATCH[2]}
# shellcheck disable=SC2016
[[ ${BASH_REMATCH[3]} == '${ENGINE_VERSION}' ]] || engine_version=${BASH_REMATCH[3]}
engine_rev=$(get_sha1 "$engine_owner" "$engine_repo" "$engine_version")
for type in mod engine; do
for name in version owner repo rev; do
var="${type}_${name}"
echo "$var=${!var}" >&2
done
echo >&2
done
i=0
for type in mod engine; do
fetcher_args=()
for name in owner repo rev; do
var="${type}_${name}"
fetcher_args+=( "--$name" "${!var}" )
done
var="${type}_version"
version=${!var}
nix-upfetch --yes --version "$version" "$(nix-preupfetch --file "$nixpkgs" "openraPackages.mods.$mod" --index $i -- "${fetcher_args[@]}")"
(( i++ ))
done

105
pkgs/games/openra/mod.nix Normal file
View file

@ -0,0 +1,105 @@
/* The package defintion for an OpenRA out-of-tree mod.
It shares code with `engine.nix` by what is defined in `common.nix`.
To build an out-of-tree mod it needs the source code of the engine available,
and they each need to be build with a specific version or fork of the engine,
so the engine needs to be supplied as an argument as well.
The engine is relatively small and quick to build, so this is not much of a problem.
Building a mod will result in a wrapper script that starts the mod inside the specified engine.
*/
{ lib, stdenv
, packageAttrs
, patchEngine
, wrapLaunchGame
, mod
, engine
}:
with lib;
let
engineSourceName = engine.src.name or "engine";
modSourceName = mod.src.name or "mod";
# Based on: https://build.opensuse.org/package/show/home:fusion809/openra-ura
in stdenv.mkDerivation (recursiveUpdate packageAttrs rec {
name = "${pname}-${version}";
pname = "openra-${mod.name}";
inherit (mod) version;
srcs = [
mod.src
engine.src
];
sourceRoot = ".";
postUnpack = ''
mv ${engineSourceName} ${modSourceName}
cd ${modSourceName}
'';
postPatch = ''
cat <<'EOF' > fetch-engine.sh
#!/bin/sh
exit 0
EOF
sed -i 's/^VERSION.*/VERSION = ${version}/g' Makefile
dos2unix *.md
${patchEngine engineSourceName engine.version}
'';
configurePhase = ''
runHook preConfigure
make version VERSION=${escapeShellArg version}
make -C ${engineSourceName} version VERSION=${escapeShellArg engine.version}
runHook postConfigure
'';
checkTarget = "test";
installPhase = ''
runHook preInstall
make -C ${engineSourceName} install-engine install-common-mod-files DATA_INSTALL_DIR=$out/lib/${pname}
cp -r ${engineSourceName}/mods/{${concatStringsSep "," ([ "common" "modcontent" ] ++ engine.mods)}} mods/* \
$out/lib/${pname}/mods/
substitute ${./mod-launch-game.sh} $out/lib/${pname}/launch-game.sh \
--subst-var out \
--subst-var-by name ${escapeShellArg mod.name} \
--subst-var-by title ${escapeShellArg mod.title} \
--subst-var-by assetsError ${escapeShellArg mod.assetsError}
chmod +x $out/lib/${pname}/launch-game.sh
${wrapLaunchGame "-${mod.name}"}
substitute ${./openra-mod.desktop} $(mkdirp $out/share/applications)/${pname}.desktop \
--subst-var-by name ${escapeShellArg mod.name} \
--subst-var-by title ${escapeShellArg mod.title} \
--subst-var-by description ${escapeShellArg mod.description}
cp README.md $(mkdirp $out/share/doc/packages/${pname})/README.md
[[ -e mods/${mod.name}/icon.png ]] && mod_icon=mods/${mod.name}/icon.png || {
[[ -e mods/${mod.name}/logo.png ]] && mod_icon=mods/${mod.name}/logo.png || mod_icon=packaging/linux/mod_256x256.png
}
cp "$mod_icon" $(mkdirp $out/share/pixmaps)/${pname}.png
for size in 16 32 48 64 128 256; do
size=''${size}x''${size}
cp packaging/linux/mod_''${size}.png $(mkdirp $out/share/icons/hicolor/''${size}/apps)/${pname}.png
done
runHook postInstall
'';
meta = {
inherit (mod) description homepage;
};
})

345
pkgs/games/openra/mods.nix Normal file
View file

@ -0,0 +1,345 @@
{ buildOpenRAMod, fetchFromGitHub, postFetch }:
let
unsafeBuildOpenRAMod = attrs: name: (buildOpenRAMod attrs name).overrideAttrs (_: {
doCheck = false;
});
in {
ca = buildOpenRAMod {
version = "96.git.fc3cf0b";
title = "Combined Arms";
description = "A game that combines units from the official OpenRA Red Alert and Tiberian Dawn mods";
homepage = "https://github.com/Inq8/CAmod";
src = fetchFromGitHub {
owner = "Inq8";
repo = "CAmod";
rev = "fc3cf0baf2b827650eaae9e1d2335a3eed24bac9";
sha256 = "15w91xs253gyrlzsgid6ixxjazx0fbzick6vlkiay0znb58n883m";
};
engine = {
version = "b8a7dd5";
src = fetchFromGitHub {
owner = "Inq8";
repo = "CAengine" ;
rev = "b8a7dd52ff893ed8225726d4ed4e14ecad748404";
sha256 = "0dyk861qagibx8ldshz7d2nrki9q550f6f0wy8pvayvf1gv1dbxj";
name = "engine";
inherit postFetch;
};
};
};
d2 = unsafeBuildOpenRAMod rec {
version = "134.git.69a4aa7";
title = "Dune II";
description = "A modernization of the original ${title} game";
homepage = "https://github.com/OpenRA/d2";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "d2";
rev = "69a4aa708e2c26376469c0048fac13592aa452ca";
sha256 = "1mfch4s6c05slyqvxllklbxpqq8dqcbx3515n3gyylyq43gq481r";
};
engine = rec {
version = "release-20181215";
mods = [ "cnc" "d2k" "ra" ];
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA" ;
rev = version;
sha256 = "0p0izykjnz7pz02g2khp7msqa00jhjsrzk9y0g29dirmdv75qa4r";
name = "engine";
inherit postFetch;
};
};
assetsError = ''
The mod expects the original ${title} game assets in place:
https://github.com/OpenRA/d2/wiki
'';
};
dr = buildOpenRAMod rec {
version = "324.git.ffcd6ba";
title = "Dark Reign";
description = "A re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/drogoganor/DarkReign";
src = fetchFromGitHub {
owner = "drogoganor";
repo = "DarkReign";
rev = "ffcd6ba72979e5f77508136ed7b0efc13e4b100e";
sha256 = "07g4qw909649s3i1yhw75613mpwfka05jana5mpp5smhnf0pkack";
};
engine = {
version = "DarkReign";
src = fetchFromGitHub {
owner = "drogoganor";
repo = "OpenRA" ;
rev = "f91d3f2603bbf51afaa89357e4defcdc36138102";
sha256 = "05g900ri6q0zrkrk8rmjaz576vjggmi2y6jm0xz3cwli54prn11w";
name = "engine";
inherit postFetch;
};
};
};
gen = buildOpenRAMod {
version = "1157.git.4f5e11d";
title = "Generals Alpha";
description = "Re-imagination of the original Command & Conquer: Generals game";
homepage = "https://github.com/MustaphaTR/Generals-Alpha";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "Generals-Alpha";
rev = "4f5e11d916e4a03d8cf1c97eef484ce2d77d7df2";
sha256 = "1wnl4qrlhynnlahgdlxwhgsdba5wgdg9yrv9f8hkgi69j60szypd";
};
engine = rec {
version = "gen-20190128_3";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "OpenRA" ;
rev = version;
sha256 = "1x6byz37s8qcpqj902zvkvbv95rv2mv2kj35c12gbpyc92xkqkq0";
name = "generals-alpha-engine";
inherit postFetch;
};
};
};
kknd = let version = "145.git.5530bab"; in name: (buildOpenRAMod rec {
inherit version;
title = "Krush, Kill 'n' Destroy";
description = "Re-imagination of the original ${title} game";
homepage = "https://kknd-game.com/";
src = fetchFromGitHub {
owner = "IceReaper";
repo = "KKnD";
rev = "5530babcb05170e0959e4cf2b079161e9fedde4f";
sha256 = "07jczrarmgm6zdk0myzwgq200x19yvpjyxrnhdac08mjgyz75zk1";
};
engine = {
version = "4e8eab4ca00d1910203c8a103dfd2c002714daa8";
src = fetchFromGitHub {
owner = "IceReaper";
repo = "OpenRA" ;
# commit does not exist on any branch on the target repository
rev = "4e8eab4ca00d1910203c8a103dfd2c002714daa8";
sha256 = "1yyqparf93x8yzy1f46gsymgkj5jls25v2yc7ighr3f7mi3igdvq";
name = "engine";
inherit postFetch;
};
};
} name).overrideAttrs (origAttrs: {
postPatch = ''
${origAttrs.postPatch}
sed -i 's/{DEV_VERSION}/${version}/' mods/*/mod.yaml
'';
});
mw = buildOpenRAMod rec {
version = "257.git.c9be8f2";
title = "Medieval Warfare";
description = "A re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/CombinE88/Medieval-Warfare";
src = fetchFromGitHub {
owner = "CombinE88";
repo = "Medieval-Warfare";
rev = "c9be8f2a6f1dd710b1aedd9d5b00b4cf5020e2fe";
sha256 = "09fp7k95jd6hjqdasbspbd43z5670wkyzbbgqkll9dfsrv0sky0v";
};
engine = {
version = "MedievalWarfareEngine";
src = fetchFromGitHub {
owner = "CombinE88";
repo = "OpenRA" ;
rev = "52109c0910f479753704c46fb19e8afaab353c83";
sha256 = "0ga3855j6bc7h81q03cw6laiaiz12915zg8aqah1idvxbzicfy7l";
name = "engine";
inherit postFetch;
};
};
};
ra2 = buildOpenRAMod rec {
version = "903.git.2f7c700";
title = "Red Alert 2";
description = "Re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/OpenRA/ra2";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "ra2";
rev = "2f7c700d6d63c0625e7158ef3098221fa6741569";
sha256 = "11vnzwczn47wjfrq6y7z9q234p27ihdrcl5p87i6h2xnrpwi8b6m";
};
engine = rec {
version = "release-20180923";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA" ;
rev = version;
sha256 = "1pgi3zaq9fwwdq6yh19bwxscslqgabjxkvl9bcn1a5agy4bfbqk5";
name = "engine";
inherit postFetch;
};
};
assetsError = ''
The mod expects the original ${title} game assets in place:
https://github.com/OpenRA/ra2/wiki
'';
};
raclassic = buildOpenRAMod {
version = "183.git.c76c13e";
title = "Red Alert Classic";
description = "A modernization of the original Command & Conquer: Red Alert game";
homepage = "https://github.com/OpenRA/raclassic";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "raclassic";
rev = "c76c13e9f0912a66ddebae8d05573632b19736b2";
sha256 = "1cnr3ccvrkjlv8kkdcglcfh133yy0fkva9agwgvc7wlj9n5ydl4g";
};
engine = rec {
version = "release-20190314";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA" ;
rev = version;
sha256 = "15pvn5cx3g0nzbrgpsfz8dngad5wkzp5dz25ydzn8bmxafiijvcr";
name = "engine";
inherit postFetch;
};
};
};
rv = unsafeBuildOpenRAMod {
version = "1330.git.9230e6f";
title = "Romanov's Vengeance";
description = "Re-imagination of the original Command & Conquer: Red Alert 2 game";
homepage = "https://github.com/MustaphaTR/Romanovs-Vengeance";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "Romanovs-Vengeance";
rev = "9230e6f1dd9758467832aee4eda115e18f0e635f";
sha256 = "0bwbmmlhp1kh8rgk2nx1ca9vqssj849amndacf318d61gksc1w9n";
};
engine = {
version = "f3873ae";
mods = [ "as" ];
src = fetchFromGitHub {
owner = "AttacqueSuperior";
repo = "Engine";
rev = "f3873ae242803051285994d77eb26f4b951594b5";
sha256 = "02rv29wja0p5d083pd087daz7x7pp5b9ym7sci2fhg3mrnaqgwkp";
name = "engine";
inherit postFetch;
};
};
assetsError = ''
The mod expects the Command & Conquer: The Ultimate Collection assets in place:
https://github.com/OpenRA/ra2/wiki
'';
};
sp = unsafeBuildOpenRAMod {
version = "221.git.ac000cc";
title = "Shattered Paradise";
description = "Re-imagination of the original Command & Conquer: Tiberian Sun game";
homepage = "https://github.com/ABrandau/OpenRAModSDK";
src = fetchFromGitHub {
owner = "ABrandau";
repo = "OpenRAModSDK";
rev = "ac000cc15377cdf6d3c2b72c737d692aa0ed8bcd";
sha256 = "16mzs5wcxj9nlpcyx2c87idsqpbm40lx0rznsccclnlb3hiwqas9";
};
engine = {
version = "SP-22-04-19";
mods = [ "as" "ts" ];
src = fetchFromGitHub {
owner = "ABrandau";
repo = "OpenRA" ;
rev = "bb0930008a57c07f3002421023f6b446e3e3af69";
sha256 = "1jvgpbf56hd02ikhklv49br4d1jiv5hphc5kl79qnjlaacnj222x";
name = "engine";
inherit postFetch;
};
};
};
ss = buildOpenRAMod rec {
version = "77.git.23e1f3e";
title = "Sole Survivor";
description = "A re-imagination of the original Command & Conquer: ${title} game";
homepage = "https://github.com/MustaphaTR/sole-survivor";
src = fetchFromGitHub {
owner = "MustaphaTR";
repo = "sole-survivor";
rev = "23e1f3e5d8b98c936797b6680d95d56a69a9e2ab";
sha256 = "104clmxphchs7r8y7hpmw103bychayz80bqj98bp89i64nv9d89x";
};
engine = {
version = "6de92de";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA" ;
rev = "6de92de8d982094a766eab97a92225c240d85493";
sha256 = "0ps9x379plrrj1hnj4fpr26lc46mzgxknv5imxi0bmrh5y4781ql";
name = "engine";
inherit postFetch;
};
};
};
ura = buildOpenRAMod {
version = "431.git.128dc53";
title = "Red Alert Unplugged";
description = "Re-imagination of the original Command & Conquer: Red Alert game";
homepage = "http://redalertunplugged.com/";
src = fetchFromGitHub {
owner = "RAunplugged";
repo = "uRA";
rev = "128dc53741fae923f4af556f2293ceaa0cf571f0";
sha256 = "1mhr8kyh313z52gdrqv31d6z7jvdldiajalca5mcr8gzg6mph66p";
};
engine = rec {
version = "unplugged-cd82382";
src = fetchFromGitHub {
owner = "RAunplugged";
repo = "OpenRA" ;
rev = version;
sha256 = "1p5hgxxvxlz8480vj0qkmnxjh7zj3hahk312m0zljxfdb40652w1";
name = "engine";
inherit postFetch;
};
};
};
yr = unsafeBuildOpenRAMod rec {
version = "199.git.5b8b952";
homepage = "https://github.com/cookgreen/yr";
title = "Yuri's Revenge";
description = "Re-imagination of the original Command & Conquer: ${title} game";
src = fetchFromGitHub {
owner = "cookgreen";
repo = "yr";
rev = "5b8b952dbe21f194a6d00485f20e215ce8362712";
sha256 = "0hxzrqnz5d7qj1jjr20imiyih62x1cnmndf75nnil4c4sj82f9a6";
};
engine = rec {
version = "release-20190314";
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA" ;
rev = version;
sha256 = "15pvn5cx3g0nzbrgpsfz8dngad5wkzp5dz25ydzn8bmxafiijvcr";
name = "engine";
inherit postFetch;
};
};
assetsError = ''
The mod expects the Command & Conquer: The Ultimate Collection assets in place:
https://github.com/OpenRA/ra2/wiki
'';
};
}

View file

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=OpenRA - @title@
GenericName=Real Time Strategy Game
GenericName[de]=Echtzeit-Strategiespiel
Comment=@description@
Icon=openra-@name@
Exec=openra-@name@
Terminal=false
Categories=Game;StrategyGame;X-RTS;X-RealTimeStrategy;X-RealTimeStrategyGame;

View file

@ -0,0 +1,60 @@
pkgs:
let
/* Building an engine or out-of-tree mod is very similar,
but different enough not to be able to build them with the same package definition,
so instaed we define what is common between them in a seperate file.
Although `callPackage` could be used, it would require undoing `makeOverridable`,
because `common.nix` does not define a package, but just an attribute set,
which is directly passed as part of the argument to the engines and mods `callPackage`,
so either the attributes added by `makeOverridable` have to be removed
or the engine and mod package definitions will need to add `...` to the argument list.
*/
common = let f = import ./common.nix; in f (builtins.intersectAttrs (builtins.functionArgs f) pkgs // {
lua = pkgs.lua5_1;
# It is not necessary to run the game, but it is nicer to be given an error dialog in the case of failure,
# rather than having to look to the logs why it is not starting.
inherit (pkgs.gnome) zenity;
});
/* Building a set of engines or mods requires some dependencies as well,
so the sets will actually be defined as a function instead,
requiring the dependencies and returning the actual set.
Not all dependencies for defining a engine or mod set are shared,
so additional arguments can be passed as well.
The builders for engines and mods allow to delay specifying the name,
by returning a function that expects a name, which we use, in this case,
to base the name on the attribute name instead, preventing the need to specify the name twice
if the attribute name and engine/mod name are equal.
*/
buildOpenRASet = f: args: builtins.mapAttrs (name: value: if builtins.isFunction value then value name else value) (f ({
inherit (pkgs) fetchFromGitHub;
postFetch = ''
sed -i 's/curl/curl --insecure/g' $out/thirdparty/{fetch-thirdparty-deps,noget}.sh
$out/thirdparty/fetch-thirdparty-deps.sh
'';
} // args));
in rec {
# The whole attribute set is destructered to ensure those (and only those) attributes are given
# and to provide defaults for those that are optional.
buildOpenRAEngine = { name ? null, version, description, homepage, mods, src, installExperimental ? "" }@engine:
# Allow specifying the name at a later point if no name has been given.
let builder = name: pkgs.callPackage ./engine.nix (common // {
engine = engine // { inherit name installExperimental; };
}); in if name == null then builder else builder name;
# See `buildOpenRAEngine`.
buildOpenRAMod = { name ? null, version, title, description, homepage, src, engine }@mod: ({ version, mods ? [], src }@engine:
let builder = name: pkgs.callPackage ./mod.nix (common // {
mod = mod // { inherit name; };
engine = engine // { inherit mods; };
}); in if name == null then builder else builder name) engine;
# See `buildOpenRASet`.
engines = buildOpenRASet (import ./engines.nix) { inherit buildOpenRAEngine; };
mods = buildOpenRASet (import ./mods.nix) { inherit buildOpenRAMod; };
}