nixpkgs/pkgs/games/zdoom/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

56 lines
1.5 KiB
Nix

{ lib, stdenv, fetchurl, p7zip, cmake
, SDL2, openal, fluidsynth, soundfont-fluid, bzip2, zlib, libjpeg, game-music-emu
, libsndfile, mpg123 }:
stdenv.mkDerivation rec {
pname = "zdoom";
majorVersion = "2.8";
version = "${majorVersion}.1";
src = fetchurl {
url = "https://zdoom.org/files/zdoom/${majorVersion}/zdoom-${version}-src.7z";
sha256 = "0453fqrh9l00xwphfxni5qkf9y134n3s1mr1dvi5cbkxcva7j8bq";
};
nativeBuildInputs = [ p7zip cmake ];
buildInputs = [
SDL2 openal fluidsynth bzip2 zlib libjpeg game-music-emu libsndfile mpg123
];
cmakeFlags = [
"-DFORCE_INTERNAL_GME=OFF"
"-DGME_INCLUDE_DIR=${game-music-emu}/include"
"-DGME_LIBRARIES=${game-music-emu}/lib/libgme.so"
];
sourceRoot = ".";
NIX_CFLAGS_LINK = [ "-lopenal" "-lfluidsynth" ];
preConfigure = ''
sed -i \
-e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
-e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
src/sound/music_fluidsynth_mididevice.cpp
'';
installPhase = ''
install -Dm755 zdoom "$out/lib/zdoom/zdoom"
for i in *.pk3; do
install -Dm644 "$i" "$out/lib/zdoom/$i"
done
mkdir -p $out/bin
ln -s $out/lib/zdoom/zdoom $out/bin/zdoom
'';
meta = with lib; {
homepage = "http://zdoom.org/";
description = "Enhanced port of the official DOOM source code";
# Doom source license, MAME license
license = licenses.unfreeRedistributable;
platforms = platforms.linux;
maintainers = with maintainers; [ lassulus ];
};
}