1 { lib, stdenv, requireFile, autoPatchelfHook, undmg, fetchurl, makeDesktopItem, copyDesktopItems, imagemagick
2 , runCommand, libgcc, wxGTK32, innoextract, libGL, SDL2, openal, libmpg123, libxmp }:
7 x86_64-linux = fetchurl {
8 url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-amd64.tar.bz2";
9 hash = "sha256-aoGzWuakwN/OL4+xUq8WEpd2c1rrNN/DkffI2vDVGjs=";
11 aarch64-linux = fetchurl {
12 url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-arm64.tar.bz2";
13 hash = "sha256-2e9lHB12jLTR8UYofLWL7gg0qb2IqFk6eND3T5VqAx0=";
15 i686-linux = fetchurl {
16 url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-x86.tar.bz2";
17 hash = "sha256-1JsFKuAAj/LtYvOUPFu0Hn+zvY3riW0YlJbLd4UnaKU=";
19 x86_64-darwin = fetchurl {
20 url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-macOS-Sonoma.dmg";
21 hash = "sha256-TbhJbOH4E5WOb6XR9dmqLkXziK3/CzhNjd1ypBkkmvw=";
24 unpackGog = runCommand "ut1999-gog" {
25 src = requireFile rec {
26 name = "setup_ut_goty_2.0.0.5.exe";
27 hash = "sha256-TMJX1U2XZZxQYvK/GG0KjGlZVh0R5C2Pzy6sB/GSaAM=";
29 Unreal Tournament 1999 requires the official GOG package, version 2.0.0.5.
31 Once you download the file, run the following command:
33 nix-prefetch-url file://\$PWD/${name}
37 nativeBuildInputs = [ innoextract ];
39 innoextract --extract --exclude-temp "$src"
44 x86_64-linux = "System64";
45 aarch64-linux = "SystemARM64";
46 x86_64-darwin = "System";
47 i686-linux = "System";
48 }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
49 in stdenv.mkDerivation {
53 src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
66 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
70 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
75 outPrefix = if stdenv.hostPlatform.isDarwin then "$out/UnrealTournament.app/Contents/MacOS" else "$out";
80 cp -r ${if stdenv.hostPlatform.isDarwin then "UnrealTournament.app" else "./*"} $out
84 rm -rf ./{Music,Sounds,Maps}
85 ln -s ${unpackGog}/{Music,Sounds,Maps} .
87 cp -n ${unpackGog}/Textures/* ./Textures || true
88 cp -n ${unpackGog}/System/*.{u,int} ./System || true
89 '' + lib.optionalString (stdenv.hostPlatform.isLinux) ''
90 ln -s "$out/${systemDir}/ut-bin" "$out/bin/ut1999"
91 ln -s "$out/${systemDir}/ucc-bin" "$out/bin/ut1999-ucc"
93 convert "${unpackGog}/gfw_high.ico" "ut1999.png"
94 install -D ut1999-5.png "$out/share/icons/hicolor/256x256/apps/ut1999.png"
96 # Remove bundled libraries to use native versions instead
97 rm $out/${systemDir}/libmpg123.so* \
98 $out/${systemDir}/libopenal.so* \
99 $out/${systemDir}/libSDL2* \
100 $out/${systemDir}/libxmp.so*
105 # Bring in game's .so files into lookup. Otherwise game fails to start
106 # as: `Object not found: Class Render.Render`
108 "${placeholder "out"}/${systemDir}"
114 desktopName = "Unreal Tournament GOTY (1999)";
117 comment = "Unreal Tournament GOTY (1999) with the OldUnreal patch.";
118 categories = [ "Game" ];
123 description = "Unreal Tournament GOTY (1999) with the OldUnreal patch";
124 license = licenses.unfree;
125 platforms = attrNames srcs;
126 maintainers = with maintainers; [ eliandoran ];
127 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
128 mainProgram = "ut1999";