nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 p7zip,
6 cmake,
7 SDL2,
8 openal,
9 fluidsynth,
10 soundfont-fluid,
11 bzip2,
12 zlib,
13 libjpeg,
14 game-music-emu,
15 libsndfile,
16 mpg123,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "zdoom";
21 majorVersion = "2.8";
22 version = "${majorVersion}.1";
23
24 src = fetchurl {
25 url = "https://zdoom.org/files/zdoom/${majorVersion}/zdoom-${version}-src.7z";
26 sha256 = "0453fqrh9l00xwphfxni5qkf9y134n3s1mr1dvi5cbkxcva7j8bq";
27 };
28
29 nativeBuildInputs = [
30 p7zip
31 cmake
32 ];
33 buildInputs = [
34 SDL2
35 openal
36 fluidsynth
37 bzip2
38 zlib
39 libjpeg
40 game-music-emu
41 libsndfile
42 mpg123
43 ];
44
45 cmakeFlags = [
46 "-DFORCE_INTERNAL_GME=OFF"
47 "-DGME_INCLUDE_DIR=${game-music-emu}/include"
48 "-DGME_LIBRARIES=${game-music-emu}/lib/libgme.so"
49 ];
50
51 sourceRoot = ".";
52
53 NIX_CFLAGS_LINK = [
54 "-lopenal"
55 "-lfluidsynth"
56 ];
57
58 preConfigure = ''
59 sed -i \
60 -e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
61 -e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
62 src/sound/music_fluidsynth_mididevice.cpp
63 '';
64
65 installPhase = ''
66 install -Dm755 zdoom "$out/lib/zdoom/zdoom"
67 for i in *.pk3; do
68 install -Dm644 "$i" "$out/lib/zdoom/$i"
69 done
70 mkdir -p $out/bin
71 ln -s $out/lib/zdoom/zdoom $out/bin/zdoom
72 '';
73
74 meta = {
75 homepage = "http://zdoom.org/";
76 description = "Enhanced port of the official DOOM source code";
77 # Doom source license, MAME license
78 license = lib.licenses.unfreeRedistributable;
79 platforms = lib.platforms.linux;
80 maintainers = with lib.maintainers; [ lassulus ];
81 };
82}