2022-04-23 19:01:47 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
, openal
|
|
|
|
, pkg-config
|
|
|
|
, libogg
|
|
|
|
, libvorbis
|
|
|
|
, SDL2
|
|
|
|
, SDL2_image
|
|
|
|
, makeWrapper
|
|
|
|
, zlib
|
|
|
|
, file
|
|
|
|
, client ? true, server ? true
|
|
|
|
}:
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "assaultcube";
|
2022-04-23 19:01:47 +02:00
|
|
|
version = "1.3.0.2";
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "assaultcube";
|
|
|
|
repo = "AC";
|
2022-04-23 19:01:47 +02:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0qv339zw9q5q1y7bghca03gw7z4v89sl4lbr6h3b7siy08mcwiz9";
|
2018-02-05 16:06:49 +01:00
|
|
|
};
|
|
|
|
|
2022-04-23 19:01:47 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
|
|
|
copyDesktopItems
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
file
|
|
|
|
zlib
|
|
|
|
] ++ lib.optionals client [
|
|
|
|
openal
|
|
|
|
SDL2
|
|
|
|
SDL2_image
|
|
|
|
libogg
|
|
|
|
libvorbis
|
|
|
|
];
|
|
|
|
|
|
|
|
targets = (lib.optionalString server "server") + (lib.optionalString client " client");
|
2021-02-16 12:48:46 +01:00
|
|
|
makeFlags = [ "-C source/src" "CXX=${stdenv.cc.targetPrefix}c++" targets ];
|
2018-02-05 16:06:49 +01:00
|
|
|
|
2022-04-23 19:01:47 +02:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = pname;
|
|
|
|
desktopName = "AssaultCube";
|
|
|
|
comment = "A multiplayer, first-person shooter game, based on the CUBE engine. Fast, arcade gameplay.";
|
|
|
|
genericName = "First-person shooter";
|
|
|
|
categories = [ "Game" "ActionGame" "Shooter" ];
|
|
|
|
icon = "assaultcube";
|
|
|
|
exec = pname;
|
|
|
|
})
|
|
|
|
];
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
gamedatadir = "/share/games/${pname}";
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-04-23 19:01:47 +02:00
|
|
|
runHook preInstall
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
bindir=$out/bin
|
|
|
|
|
|
|
|
mkdir -p $bindir $out/$gamedatadir
|
|
|
|
|
|
|
|
cp -r config packages $out/$gamedatadir
|
|
|
|
|
|
|
|
if (test -e source/src/ac_client) then
|
|
|
|
cp source/src/ac_client $bindir
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
install -Dpm644 packages/misc/icon.png $out/share/icons/assaultcube.png
|
|
|
|
install -Dpm644 packages/misc/icon.png $out/share/pixmaps/assaultcube.png
|
2020-11-18 09:42:33 +01:00
|
|
|
|
2019-03-29 13:14:48 +01:00
|
|
|
makeWrapper $out/bin/ac_client $out/bin/${pname} \
|
2022-03-14 19:06:00 +01:00
|
|
|
--chdir "$out/$gamedatadir" --add-flags "--home=\$HOME/.assaultcube/v1.2next --init"
|
2018-02-05 16:06:49 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if (test -e source/src/ac_server) then
|
|
|
|
cp source/src/ac_server $bindir
|
2019-03-29 13:14:48 +01:00
|
|
|
makeWrapper $out/bin/ac_server $out/bin/${pname}-server \
|
2022-03-14 19:06:00 +01:00
|
|
|
--chdir "$out/$gamedatadir" --add-flags "-Cconfig/servercmdline.txt"
|
2018-02-05 16:06:49 +01:00
|
|
|
fi
|
2019-03-29 13:14:48 +01:00
|
|
|
|
2022-04-23 19:01:47 +02:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2019-03-29 13:14:48 +01:00
|
|
|
description = "Fast and fun first-person-shooter based on the Cube fps";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://assault.cubers.net";
|
2019-03-29 13:14:48 +01:00
|
|
|
platforms = platforms.linux; # should work on darwin with a little effort.
|
2022-04-23 19:01:47 +02:00
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [ darkonion0 ];
|
2019-03-29 13:14:48 +01:00
|
|
|
};
|
2018-02-05 16:06:49 +01:00
|
|
|
}
|