nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 85 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 SDL, 7 ncurses, 8 libtcod, 9 makeDesktopItem, 10}: 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "brogue"; 14 version = "1.7.5"; 15 16 src = fetchurl { 17 url = "https://drive.google.com/uc?export=download&id=1ED_2nPubP-P0e_PHKYVzZF42M1Y9pUb4"; 18 hash = "sha256-p0/xgTlWTFl9BHz7Fn90qxlj3YYItvsuA052NdYXBEQ="; 19 name = "brogue.tbz2"; 20 }; 21 22 patches = [ 23 # Pull upstream fix for -fno-common toolchains: 24 # https://github.com/tmewett/BrogueCE/pull/63 25 (fetchpatch { 26 name = "fno-common.patch"; 27 url = "https://github.com/tmewett/BrogueCE/commit/2c7ed0c48d9efd06bf0a2589ba967c0a22a8fa87.patch"; 28 sha256 = "19lr2fa25dh79klm4f4kqyyqq7w5xmw9z0fvylkcckqvcv7dwhp3"; 29 }) 30 # error: passing argument 4 of 'buildAMachine' makes integer from pointer without a cast [] 31 ./fix-compilation.diff 32 ]; 33 34 prePatch = '' 35 sed -i Makefile -e 's,LIBTCODDIR=.*,LIBTCODDIR=${libtcod},g' \ 36 -e 's,sdl-config,${lib.getDev SDL}/bin/sdl-config,g' 37 sed -i src/platform/tcod-platform.c -e "s,fonts/font,$out/share/brogue/fonts/font,g" 38 make clean 39 rm -rf src/libtcod* 40 ''; 41 42 buildInputs = [ 43 SDL 44 ncurses 45 libtcod 46 ]; 47 48 desktopItem = makeDesktopItem { 49 name = "brogue"; 50 desktopName = "Brogue"; 51 genericName = "Roguelike"; 52 comment = "Brave the Dungeons of Doom!"; 53 icon = "brogue"; 54 exec = "brogue"; 55 categories = [ 56 "Game" 57 "AdventureGame" 58 ]; 59 }; 60 61 installPhase = '' 62 install -m 555 -D bin/brogue $out/bin/brogue 63 install -m 444 -D ${finalAttrs.desktopItem}/share/applications/brogue.desktop $out/share/applications/brogue.desktop 64 install -m 444 -D bin/brogue-icon.png $out/share/icons/hicolor/256x256/apps/brogue.png 65 mkdir -p $out/share/brogue 66 cp -r bin/fonts $out/share/brogue/ 67 ''; 68 69 # fix crash; shouldn’t be a security risk because it’s an offline game 70 hardeningDisable = [ 71 "stackprotector" 72 "fortify" 73 ]; 74 75 meta = with lib; { 76 description = "Roguelike game"; 77 mainProgram = "brogue"; 78 homepage = "https://sites.google.com/site/broguegame/"; 79 license = licenses.agpl3Plus; 80 maintainers = with maintainers; [ 81 fgaz 82 ]; 83 platforms = [ "x86_64-linux" ]; 84 }; 85})