1{
2 stdenv,
3 lib,
4 fetchzip,
5 fetchurl,
6 fetchFromGitHub,
7 libarchive,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "quake3hires";
12 version = "unstable-2020-01-20"; # Unknown version, used the date of web.archive.org capture.
13
14 nativeBuildInputs = [
15 libarchive
16 ];
17
18 src = fetchzip {
19 url = "https://web.archive.org/web/20200120024216/http://ioquake3.org/files/xcsv_hires.zip";
20 sha256 = "09vhrray8mh1ic2qgcwv0zlmsnz789y32dkkvrz1vdki4yqkf717";
21 stripRoot = false;
22 };
23
24 # https://www.moddb.com/mods/high-quality-quake
25 # TODO check if that file needs renaming to something that starts with z_* so it actually overrides anything in pak0.pk3
26 extra-pack-resolution = fetchurl {
27 url = "https://web.archive.org/web/20250310093216/https://fmt3.dl.dbolical.com/dl/2018/11/06/q3a-hqq-v37.zip?st=0XzNnNvOYWrJAi_6AB3mKw==&e=1741602736";
28 hash = "sha256-0nAXkrf4ahlct75TgO18PjuT9IkH8fpDhtTflJfPpPM=";
29 };
30 # https://www.moddb.com/mods/cz45modbundle/addons/cz45-q3a-weapon-model-remake-v10
31 # https://www.moddb.com/downloads/mirror/255463/130/9de70b5dc7ebb1baa44acf91458b04f9/
32 # this is only part of the mod, only the weapons skins
33 # url = "https://github.com/diegoulloao/ioquake3-mac-install/raw/master/extras/hd-weapons.pk3";
34 hd-weapons = fetchurl {
35 name = "czq3hdweaprem_v10.zip";
36 url = "https://web.archive.org/web/20250310101737/https://fmt1.dl.dbolical.com/dl/2023/08/13/czq3hdweaprem_v10.zip?st=XBoRCpVmvTYtc60xxi36VQ==&e=1741605457";
37 hash = "sha256-pL7MsEFsKJV+a+z45Ns16SPdQB3i2D6T3x7tBqWtm1s=";
38 };
39
40 # According to the @diegoulloao (see https://github.com/diegoulloao/ioquake3-mac-install/issues/23#issuecomment-2817031996)
41 # quake3-live-sounds.pk3 is likely a custom repack from https://www.moddb.com/addons/quake-live-announcers-pack
42 # zpack-weapons.pk3 is an amalgamation of multiple mods, where he can't recall which ones he used exactly.
43 # It still makes him the authorative source for these file.
44 ioquake3_mac = fetchFromGitHub {
45 owner = "diegoulloao";
46 repo = "ioquake3-mac-install";
47 rev = "3a767ff0131742ec517fd5f13ddca16dee91927d";
48 hash = "sha256-uY3pybCnQ7lZatP3s9AiT779/4xj8N3R4qx8V6991aM=";
49 };
50
51 buildCommand = ''
52 mkdir -p $out/baseq3
53 install -Dm444 $src/xcsv_bq3hi-res.pk3 $out/baseq3/xcsv_bq3hi-res.pk3
54 install -Dm444 ${finalAttrs.extra-pack-resolution} $out/baseq3/pak9hqq37test20181106.pk3
55
56 bsdunzip ${finalAttrs.hd-weapons}
57 install -Dm444 zzczhdwr1.pk3 $out/baseq3/zzczhdwr1.pk3
58 # https://github.com/diegoulloao/ioquake3-mac-install takes only the first file, following his lead for now
59 # install -Dm444 zzczhdwr2.pk3 $out/baseq3/zzczhdwr2.pk3
60 # install -Dm444 zzczhdwr3.pk3 $out/baseq3/zzczhdwr3.pk3
61
62 install -Dm444 ${finalAttrs.ioquake3_mac}/extras/quake3-live-sounds.pk3 $out/baseq3/quake3-live-sounds.pk3
63 install -Dm444 ${finalAttrs.ioquake3_mac}/extras/zpack-weapons.pk3 $out/baseq3/zpack-weapons.pk3
64 '';
65
66 preferLocalBuild = true;
67
68 meta = with lib; {
69 description = "Quake 3 high-resolution textures";
70 license = licenses.cc0;
71 platforms = platforms.all;
72 maintainers = with maintainers; [ rvolosatovs ];
73 };
74})