1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 SDL2,
8 SDL2_mixer,
9 alsa-lib,
10 libpng,
11 pcre,
12 makeDesktopItem,
13}:
14
15stdenv.mkDerivation rec {
16
17 pname = "ivan";
18 version = "059";
19
20 src = fetchFromGitHub {
21 owner = "Attnam";
22 repo = "ivan";
23 rev = "v${version}";
24 sha256 = "sha256-5Ijy28LLx1TGnZE6ZNQXPYfvW2KprF+91fKx2MzLEms=";
25 };
26
27 nativeBuildInputs = [
28 cmake
29 pkg-config
30 ];
31
32 buildInputs = [
33 SDL2
34 SDL2_mixer
35 alsa-lib
36 libpng
37 pcre
38 ];
39
40 hardeningDisable = [ "all" ];
41
42 # Enable wizard mode
43 cmakeFlags = [ "-DCMAKE_CXX_FLAGS=-DWIZARD" ];
44
45 # Help CMake find SDL_mixer.h
46 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2_mixer}/include/SDL2";
47
48 # Create "ivan.desktop" file
49 ivanDesktop = makeDesktopItem {
50 name = pname;
51 exec = pname;
52 icon = "ivan.png";
53 desktopName = "IVAN";
54 genericName = pname;
55 categories = [
56 "Game"
57 "AdventureGame"
58 "RolePlaying"
59 ];
60 comment = meta.description;
61 };
62
63 # Create appropriate directories. Copy icons and desktop item to these directories.
64 postInstall = ''
65 mkdir -p $out/share/applications
66 mkdir -p $out/share/icons/hicolor/16x16/apps
67 mkdir -p $out/share/icons/hicolor/32x32/apps
68 mkdir -p $out/share/icons/hicolor/128x128/apps
69 mkdir -p $out/share/icons/hicolor/256x256/apps
70 mkdir -p $out/share/icons/hicolor/512x512/apps
71 cp $src/Graphics/icons/shadowless.iconset/icon_16x16.png $out/share/icons/hicolor/16x16/apps/ivan.png
72 cp $src/Graphics/icons/shadowless.iconset/icon_32x32.png $out/share/icons/hicolor/32x32/apps/ivan.png
73 cp $src/Graphics/icons/shadowless.iconset/icon_128x128.png $out/share/icons/hicolor/128x128/apps/ivan.png
74 cp $src/Graphics/icons/shadowless.iconset/icon_256x256.png $out/share/icons/hicolor/256x256/apps/ivan.png
75 cp $src/Graphics/icons/shadowless.iconset/icon_512x512.png $out/share/icons/hicolor/512x512/apps/ivan.png
76 cp ${ivanDesktop}/share/applications/* $out/share/applications
77 '';
78
79 meta = with lib; {
80 description = "Graphical roguelike game";
81 longDescription = ''
82 Iter Vehemens ad Necem (IVAN) is a graphical roguelike game, which currently
83 runs in Windows, DOS, Linux, and OS X. It features advanced bodypart and
84 material handling, multi-colored lighting and, above all, deep gameplay.
85
86 This is a fan continuation of IVAN by members of Attnam.com
87 '';
88 homepage = "https://attnam.com/";
89 license = licenses.gpl2Plus;
90 platforms = platforms.linux;
91 maintainers = [ ];
92 mainProgram = "ivan";
93 };
94}