rott: move to pkgs/by-name tree and add shareware data (#386473)

Changed files
+83 -77
pkgs
by-name
ro
games
top-level
+82
pkgs/by-name/ro/rott/package.nix
···
···
+
{
+
stdenv,
+
lib,
+
fetchurl,
+
fetchzip,
+
SDL_compat,
+
SDL_mixer,
+
makeDesktopItem,
+
copyDesktopItems,
+
unzip,
+
buildShareware ? false,
+
withSharewareData ? buildShareware,
+
}:
+
assert withSharewareData -> buildShareware;
+
+
let
+
datadir = "share/data/rott-shareware/";
+
in
+
stdenv.mkDerivation (finalAttrs: {
+
pname = "rott";
+
version = "1.1.2";
+
+
__structuredAttrs = true;
+
srcs =
+
[
+
(fetchurl {
+
url = "https://icculus.org/rott/releases/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
+
hash = "sha256-ECUW6MMS9rC79sYj4fAcv7vDFKzorf4fIB1HsVvZJ/8=";
+
})
+
]
+
++ lib.optional withSharewareData (fetchzip {
+
url = "http://icculus.org/rott/share/1rott13.zip";
+
hash = "sha256-l0pP+mNPAabGh7LZrwcB6KOhPRSycrZpAlPVTyDXc6Y=";
+
stripRoot = false;
+
});
+
+
sourceRoot = "rott-${finalAttrs.version}/rott";
+
+
nativeBuildInputs = [ copyDesktopItems ] ++ lib.optional withSharewareData unzip;
+
+
buildInputs = [
+
SDL_compat
+
SDL_mixer
+
];
+
+
enableParallelBuilding = true;
+
+
makeFlags = [
+
"SHAREWARE=${if buildShareware then "1" else "0"}"
+
''EXTRACFLAGS=-DDATADIR=\"${if withSharewareData then "${placeholder "out"}/${datadir}" else ""}\"''
+
];
+
+
installPhase = ''
+
runHook preInstall
+
+
${lib.optionalString withSharewareData ''
+
mkdir -p "$out/${datadir}"
+
unzip -d "$out/${datadir}" ../../source/ROTTSW13.SHR
+
''}
+
install -Dm755 -t $out/bin rott
+
+
runHook postInstall
+
'';
+
+
desktopItems = [
+
(makeDesktopItem {
+
name = "rott";
+
exec = "rott";
+
desktopName = "Rise of the Triad: ${if buildShareware then "The HUNT Begins" else "Dark War"}";
+
categories = [ "Game" ];
+
})
+
];
+
+
meta = {
+
description = "SDL port of Rise of the Triad";
+
mainProgram = "rott";
+
homepage = "https://icculus.org/rott/";
+
license = with lib.licenses; [ gpl2Plus ] ++ lib.optional withSharewareData unfreeRedistributable;
+
maintainers = with lib.maintainers; [ sander ];
+
platforms = lib.platforms.all;
+
};
+
})
-74
pkgs/games/rott/default.nix
···
-
{
-
stdenv,
-
lib,
-
fetchurl,
-
writeShellScript,
-
SDL,
-
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 {
-
pname = "rott";
-
version = "1.1.2";
-
-
src = fetchurl {
-
url = "https://icculus.org/rott/releases/${pname}-${version}.tar.gz";
-
sha256 = "1zr7v5dv2iqx40gzxbg8mhac7fxz3kqf28y6ysxv1xhjqgl1c98h";
-
};
-
-
nativeBuildInputs = [ copyDesktopItems ];
-
-
buildInputs = [
-
SDL
-
SDL_mixer
-
];
-
-
sourceRoot = "rott-${version}/rott";
-
-
makeFlags = [
-
"SHAREWARE=${if buildShareware then "1" else "0"}"
-
];
-
-
installPhase = ''
-
runHook preInstall
-
-
install -Dm555 -t $out/libexec rott
-
install -Dm555 ${launcher} $out/bin/${launcher.name}
-
substituteInPlace $out/bin/rott --subst-var out
-
-
runHook postInstall
-
'';
-
-
desktopItems = [
-
(makeDesktopItem {
-
name = "rott";
-
exec = "rott";
-
desktopName = "Rise of the Triad: ${if buildShareware then "The HUNT Begins" else "Dark War"}";
-
categories = [ "Game" ];
-
})
-
];
-
-
meta = with lib; {
-
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;
-
};
-
}
···
+1 -3
pkgs/top-level/all-packages.nix
···
ncurses = ncurses5;
};
-
rott = callPackage ../games/rott { SDL = SDL_compat; };
-
-
rott-shareware = rott.override {
buildShareware = true;
};
···
ncurses = ncurses5;
};
+
rott-shareware = callPackage ../by-name/ro/rott/package.nix {
buildShareware = true;
};