25 wrapper = "eduke32-wrapper";
26 swWrapper = "voidsw-wrapper";
28 in stdenv.mkDerivation (finalAttrs: {
30 version = "0-unstable-2024-02-17";
32 src = fetchFromGitLab {
33 domain = "voidpoint.io";
36 rev = "8afa42e388e0434b38979fdddc763363717a2727";
37 hash = "sha256-dyZ4JtDBxsTDe9uQDWxJe7M74X7m+5wpEHm+i+s9hwo=";
46 ] ++ lib.optionals stdenv.isLinux [
50 ] ++ lib.optionals stdenv.isDarwin [
62 ] ++ lib.optionals (stdenv.hostPlatform.system == "i686-linux") [
67 substituteInPlace source/imgui/src/imgui_impl_sdl2.cpp \
68 --replace-fail '#include <SDL.h>' '#include <SDL2/SDL.h>' \
69 --replace-fail '#include <SDL_syswm.h>' '#include <SDL2/SDL_syswm.h>' \
70 --replace-fail '#include <SDL_vulkan.h>' '#include <SDL2/SDL_vulkan.h>'
71 '' + lib.optionalString stdenv.isLinux ''
72 for f in glad.c glad_wgl.c ; do
73 substituteInPlace source/glad/src/$f \
74 --replace-fail libGL.so ${libGL}/lib/libGL.so
79 "SDLCONFIG=${SDL2}/bin/sdl2-config"
80 ] ++ lib.optionals stdenv.isDarwin [
81 # broken, see: https://github.com/NixOS/nixpkgs/issues/19098
95 comment = "Duke Nukem 3D port";
96 desktopName = "Enhanced Duke Nukem 3D";
97 genericName = "Duke Nukem 3D port";
98 categories = [ "Game" ];
103 exec = "${swWrapper}";
104 comment = "Shadow Warrior eduke32 source port";
105 desktopName = "VoidSW";
106 genericName = "Shadow Warrior source port";
107 categories = [ "Game" ];
111 enableParallelBuilding = true;
116 install -Dm755 -t $out/bin eduke32 mapster32 voidsw wangulator
117 '' + lib.optionalString stdenv.isLinux ''
118 makeWrapper $out/bin/eduke32 $out/bin/${wrapper} \
119 --set-default EDUKE32_DATA_DIR /var/lib/games/eduke32 \
120 --add-flags '-g "$EDUKE32_DATA_DIR/DUKE3D.GRP"'
121 makeWrapper $out/bin/voidsw $out/bin/${swWrapper} \
122 --set-default EDUKE32_DATA_DIR /var/lib/games/eduke32 \
123 --add-flags '-g"$EDUKE32_DATA_DIR/SW.GRP"'
124 mkdir -p $out/share/icons/hicolor/scalable/apps
125 gm convert "./source/duke3d/rsrc/game_icon.ico[10]" $out/share/icons/hicolor/scalable/apps/eduke32.png
126 install -Dm644 ./source/sw/rsrc/game_icon.svg $out/share/icons/hicolor/scalable/apps/voidsw.svg
127 '' + lib.optionalString stdenv.isDarwin ''
128 mkdir -p $out/Applications/EDuke32.app/Contents/MacOS
129 mkdir -p $out/Applications/Mapster32.app/Contents/MacOS
130 mkdir -p $out/Applications/VoidSW.app/Contents/MacOS
131 mkdir -p $out/Applications/Wangulator.app/Contents/MacOS
133 cp -r platform/Apple/bundles/EDuke32.app/* $out/Applications/EDuke32.app/
134 cp -r platform/Apple/bundles/Mapster32.app/* $out/Applications/Mapster32.app/
135 cp -r platform/Apple/bundles/VoidSW.app/* $out/Applications/VoidSW.app/
136 cp -r platform/Apple/bundles/Wangulator.app/* $out/Applications/Wangulator.app/
138 ln -sf $out/bin/eduke32 $out/Applications/EDuke32.app/Contents/MacOS/eduke32
139 ln -sf $out/bin/mapster32 $out/Applications/Mapster32.app/Contents/MacOS/mapster32
140 ln -sf $out/bin/voidsw $out/Applications/VoidSW.app/Contents/MacOS/voidsw
141 ln -sf $out/bin/wangulator $out/Applications/Wangulator.app/Contents/MacOS/wangulator
147 description = "Enhanched port of Duke Nukem 3D for various platforms";
148 homepage = "http://eduke32.com";
149 license = with lib.licenses; [ gpl2Plus ];
150 maintainers = with lib.maintainers; [ mikroskeem sander ];
151 platforms = lib.platforms.all;