Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions pkgs/by-name/ro/rott/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
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 changes: 0 additions & 74 deletions pkgs/games/rott/default.nix

This file was deleted.

4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16412,9 +16412,7 @@ with pkgs;
ncurses = ncurses5;
};

rott = callPackage ../games/rott { SDL = SDL_compat; };

rott-shareware = rott.override {
rott-shareware = callPackage ../by-name/ro/rott/package.nix {
buildShareware = true;
};

Expand Down