1{
2 SDL2,
3 fetchFromGitHub,
4 flac,
5 glslang,
6 gzip,
7 lib,
8 libmpg123,
9 libopus,
10 libvorbis,
11 libX11,
12 makeWrapper,
13 meson,
14 moltenvk,
15 ninja,
16 opusfile,
17 pkg-config,
18 stdenv,
19 vulkan-headers,
20 vulkan-loader,
21 copyDesktopItems,
22 makeDesktopItem,
23}:
24stdenv.mkDerivation (finalAttrs: {
25 pname = "vkquake";
26 version = "1.32.3.1";
27
28 src = fetchFromGitHub {
29 owner = "Novum";
30 repo = "vkQuake";
31 tag = finalAttrs.version;
32 hash = "sha256-Hsj6LgxlEICI3MMDMCE1KvslYrsYfQPhShpP5kzLCTI=";
33 };
34
35 nativeBuildInputs = [
36 makeWrapper
37 glslang
38 meson
39 ninja
40 pkg-config
41 copyDesktopItems
42 ];
43
44 buildInputs = [
45 SDL2
46 flac
47 gzip
48 libmpg123
49 libopus
50 libvorbis
51 libX11
52 opusfile
53 vulkan-loader
54 ]
55 ++ lib.optionals stdenv.hostPlatform.isDarwin [
56 moltenvk
57 vulkan-headers
58 ];
59
60 buildFlags = [ "DO_USERDIRS=1" ];
61
62 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
63 NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [
64 "-Wno-error=unused-but-set-variable"
65 "-Wno-error=implicit-const-int-float-conversion"
66 ];
67 };
68
69 installPhase = ''
70 runHook preInstall
71
72 mkdir -p "$out/bin"
73 cp vkquake "$out/bin"
74
75 install -D ../Misc/vkQuake_256.png "$out/share/icons/hicolor/256x256/apps/vkquake.png"
76
77 runHook postInstall
78 '';
79
80 desktopItems = [
81 (makeDesktopItem {
82 exec = finalAttrs.meta.mainProgram;
83 name = "vkquake";
84 icon = "vkquake";
85 comment = finalAttrs.meta.description;
86 desktopName = "vkQuake";
87 categories = [ "Game" ];
88 })
89 ];
90
91 postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
92 patchelf $out/bin/vkquake \
93 --add-rpath ${lib.makeLibraryPath [ vulkan-loader ]}
94 '';
95
96 meta = {
97 description = "Vulkan Quake port based on QuakeSpasm";
98 homepage = "https://github.com/Novum/vkQuake";
99 changelog = "https://github.com/Novum/vkQuake/releases";
100 longDescription = ''
101 vkQuake is a Quake 1 port using Vulkan instead of OpenGL for rendering.
102 It is based on the popular QuakeSpasm port and runs all mods compatible with it
103 like Arcane Dimensions or In The Shadows. vkQuake also serves as a Vulkan demo
104 application that shows basic usage of the API. For example it demonstrates render
105 passes & sub passes, pipeline barriers & synchronization, compute shaders, push &
106 specialization constants, CPU/GPU parallelism and memory pooling.
107 '';
108
109 platforms = with lib.platforms; linux ++ darwin;
110 maintainers = with lib.maintainers; [
111 PopeRigby
112 ylh
113 ];
114 mainProgram = "vkquake";
115 license = lib.licenses.gpl2Plus;
116 };
117})