2022-05-10 08:42:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, writeShellScript
|
|
|
|
, SDL
|
|
|
|
, SDL_mixer
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
, runtimeShell
|
|
|
|
, buildShareware ? false
|
|
|
|
}:
|
2021-07-28 19:29:23 +00:00
|
|
|
|
2022-05-10 08:42:52 +00:00
|
|
|
let
|
|
|
|
# Allow the game to be launched from a user's PATH and load the game data from the user's home directory.
|
|
|
|
launcher = writeShellScript "rott" ''
|
|
|
|
set -eEuo pipefail
|
|
|
|
dir=$HOME/.rott/data
|
|
|
|
test -e $dir || mkdir -p $dir
|
|
|
|
cd $dir
|
|
|
|
exec @out@/libexec/rott "$@"
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
2021-07-28 19:29:23 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rott";
|
|
|
|
version = "1.1.2";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://icculus.org/rott/releases/${pname}-${version}.tar.gz";
|
|
|
|
sha256 = "1zr7v5dv2iqx40gzxbg8mhac7fxz3kqf28y6ysxv1xhjqgl1c98h";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ copyDesktopItems ];
|
2022-05-10 08:42:52 +00:00
|
|
|
|
2021-07-28 19:29:23 +00:00
|
|
|
buildInputs = [ SDL SDL_mixer ];
|
|
|
|
|
2022-05-10 08:42:52 +00:00
|
|
|
sourceRoot = "rott-${version}/rott";
|
2021-07-28 19:29:23 +00:00
|
|
|
|
2022-05-10 08:42:52 +00:00
|
|
|
makeFlags = [
|
|
|
|
"SHAREWARE=${if buildShareware then "1" else "0"}"
|
|
|
|
];
|
2021-07-28 19:29:23 +00:00
|
|
|
|
2024-09-03 18:14:14 +00:00
|
|
|
# when using SDL_compat instead of SDL1, SDL_mixer isn't correctly detected,
|
|
|
|
# but there is no harm just specifying it
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2022-05-10 08:42:52 +00:00
|
|
|
"-I${lib.getDev SDL_mixer}/include/SDL"
|
|
|
|
];
|
2021-07-28 19:29:23 +00:00
|
|
|
|
2022-05-10 08:42:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2021-07-28 19:29:23 +00:00
|
|
|
|
2022-05-10 08:42:52 +00:00
|
|
|
install -Dm555 -t $out/libexec rott
|
|
|
|
install -Dm555 ${launcher} $out/bin/${launcher.name}
|
|
|
|
substituteInPlace $out/bin/rott --subst-var out
|
2021-07-28 19:29:23 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "rott";
|
2022-05-10 08:42:52 +00:00
|
|
|
exec = "rott";
|
2021-07-28 19:29:23 +00:00
|
|
|
desktopName = "Rise of the Triad: ${if buildShareware then "The HUNT Begins" else "Dark War"}";
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Game" ];
|
2021-07-28 19:29:23 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "SDL port of Rise of the Triad";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "rott";
|
2021-07-28 19:29:23 +00:00
|
|
|
homepage = "https://icculus.org/rott/";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ sander ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|