1 { fetchFromGitHub, lib, stdenv, cmake, pkg-config, python3, alsa-lib
2 , libX11, libGLU, SDL2, lua5_3, zlib, freetype, wavpack, icoutils
8 stdenv.mkDerivation rec {
12 src = fetchFromGitHub {
16 sha256 = "1l19ksmimg6b8zzjy0skyhh7z11ql7n5gvilkv7ay5x2b9ndbqwz";
17 fetchSubmodules = true;
21 # Can't use fetchpatch or fetchpatch2 because of https://github.com/NixOS/nixpkgs/issues/32084
22 # Using fetchurl instead is also not a good idea, see https://github.com/NixOS/nixpkgs/issues/32084#issuecomment-727223713
23 ./rename-VERSION-to-VERSION.txt.patch
27 # set compiled-in DATA_DIR so resources can be found
28 substituteInPlace src/engine/shared/storage.cpp \
29 --replace '#define DATA_DIR "data"' \
30 '#define DATA_DIR "${placeholder "out"}/share/teeworlds/data"'
32 # Quote nonsense is a workaround for https://github.com/NixOS/nix/issues/661
33 substituteInPlace 'other/bundle/client/Info.plist.in' \
34 --replace ${"'"}''${TARGET_CLIENT}' 'teeworlds' \
35 --replace ${"'"}''${PROJECT_VERSION}' '${version}'
41 ] ++ lib.optionals stdenv.isLinux [
46 python3 libGLU SDL2 lua5_3 zlib freetype wavpack
47 ] ++ lib.optionals stdenv.isLinux [
50 ] ++ lib.optionals stdenv.isDarwin [
55 postInstall = lib.optionalString stdenv.isLinux ''
56 # Convert and install desktop icon
57 mkdir -p $out/share/pixmaps
58 icotool --extract --index 1 --output $out/share/pixmaps/teeworlds.png $src/other/icons/teeworlds.ico
61 install -D $src/other/teeworlds.desktop $out/share/applications/teeworlds.desktop
62 '' + lib.optionalString stdenv.isDarwin ''
63 mkdir -p "$out/Applications/teeworlds.app/Contents/MacOS"
64 mkdir -p "$out/Applications/teeworlds.app/Contents/Resources"
66 cp '../other/icons/teeworlds.icns' "$out/Applications/teeworlds.app/Contents/Resources/"
67 cp '../other/bundle/client/Info.plist.in' "$out/Applications/teeworlds.app/Contents/Info.plist"
68 cp '../other/bundle/client/PkgInfo' "$out/Applications/teeworlds.app/Contents/"
69 ln -s "$out/bin/teeworlds" "$out/Applications/teeworlds.app/Contents/MacOS/"
70 ln -s "$out/share/teeworlds/data" "$out/Applications/teeworlds.app/Contents/Resources/data"
73 passthru.tests.teeworlds = nixosTests.teeworlds;
76 description = "Retro multiplayer shooter game";
79 Teeworlds is a free online multiplayer game, available for all
80 major operating systems. Battle with up to 12 players in a
81 variety of game modes, including Team Deathmatch and Capture The
82 Flag. You can even design your own maps!
85 homepage = "https://teeworlds.com/";
86 license = "BSD-style, see `license.txt'";
87 maintainers = with lib.maintainers; [ astsmtl Luflosi ];
88 platforms = lib.platforms.unix;