Skip to content

Commit

Permalink
rott: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-serwin committed Mar 10, 2025
1 parent c8def8c commit fa72edb
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions pkgs/by-name/ro/rott/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,19 @@
stdenv,
lib,
fetchurl,
writeShellScript,
SDL_compat,
SDL_mixer,
makeDesktopItem,
copyDesktopItems,
runtimeShell,
buildShareware ? false,
}:

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
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "rott";
version = "1.1.2";

src = fetchurl {
url = "https://icculus.org/rott/releases/${pname}-${version}.tar.gz";
sha256 = "1zr7v5dv2iqx40gzxbg8mhac7fxz3kqf28y6ysxv1xhjqgl1c98h";
url = "https://icculus.org/rott/releases/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
hash = "sha256-ECUW6MMS9rC79sYj4fAcv7vDFKzorf4fIB1HsVvZJ/8=";
};

nativeBuildInputs = [ copyDesktopItems ];
Expand All @@ -38,7 +24,9 @@ stdenv.mkDerivation rec {
SDL_mixer
];

sourceRoot = "rott-${version}/rott";
enableParallelBuilding = true;

sourceRoot = "rott-${finalAttrs.version}/rott";

makeFlags = [
"SHAREWARE=${if buildShareware then "1" else "0"}"
Expand All @@ -47,9 +35,7 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
install -Dm555 -t $out/libexec rott
install -Dm555 ${launcher} $out/bin/${launcher.name}
substituteInPlace $out/bin/rott --subst-var out
install -Dm755 -t $out/bin rott
runHook postInstall
'';
Expand All @@ -63,12 +49,12 @@ stdenv.mkDerivation rec {
})
];

meta = with lib; {
meta = {
description = "SDL port of Rise of the Triad";
mainProgram = "rott";
homepage = "https://icculus.org/rott/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ sander ];
platforms = platforms.all;
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ sander ];
platforms = lib.platforms.all;
};
}
})

0 comments on commit fa72edb

Please sign in to comment.