Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / mudlet / default.nix
blob52990a2d5eab62d3c3b0f9178126ea167f64af4a
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cmake
5 , git
6 , pkg-config
7 , qttools
8 , which
9 , wrapQtAppsHook
10 , boost
11 , hunspell
12 , libGLU
13 , libsForQt5
14 , libsecret
15 , libzip
16 , lua
17 , pcre
18 , pugixml
19 , qtbase
20 , qtmultimedia
21 , discord-rpc
22 , yajl
25 let
26   overrideLua =
27     let
28       packageOverrides = self: super: {
29         # luasql-sqlite3 master branch broke compatibility with lua 5.1. Pin to
30         # an earlier commit.
31         # https://github.com/lunarmodules/luasql/issues/147
32         luasql-sqlite3 = super.luaLib.overrideLuarocks super.luasql-sqlite3
33           (drv: {
34             version = "2.6.0-1-custom";
35             src = fetchFromGitHub {
36               owner = "lunarmodules";
37               repo = "luasql";
38               rev = "8c58fd6ee32faf750daf6e99af015a31402578d1";
39               hash = "sha256-XlTB5O81yWCrx56m0cXQp7EFzeOyfNeqGbuiYqMrTUk=";
40             };
41           });
42       };
43     in
44     lua.override { inherit packageOverrides; };
46   luaEnv = overrideLua.withPackages (ps: with ps; [
47     luazip
48     luafilesystem
49     lrexlib-pcre
50     luasql-sqlite3
51     lua-yajl
52     luautf8
53   ]);
55 stdenv.mkDerivation rec {
56   pname = "mudlet";
57   version = "4.17.2";
59   src = fetchFromGitHub {
60     owner = "Mudlet";
61     repo = "Mudlet";
62     rev = "Mudlet-${version}";
63     fetchSubmodules = true;
64     hash = "sha256-K75frptePKfHeGQNXaX4lKsLwO6Rs6AAka6hvP8MA+k=";
65   };
67   nativeBuildInputs = [
68     cmake
69     git
70     pkg-config
71     qttools
72     which
73     wrapQtAppsHook
74   ];
76   buildInputs = [
77     boost
78     hunspell
79     libGLU
80     libsForQt5.qtkeychain
81     libsecret
82     libzip
83     luaEnv
84     pcre
85     pugixml
86     qtbase
87     qtmultimedia
88     yajl
89     discord-rpc
90   ];
92   cmakeFlags = [
93     # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
94     "-DCMAKE_SKIP_BUILD_RPATH=ON"
95   ];
97   WITH_FONTS = "NO";
98   WITH_UPDATER = "NO";
100   installPhase = ''
101     runHook preInstall
103     mkdir -pv $out/lib
104     cp 3rdparty/edbee-lib/edbee-lib/qslog/lib/libQsLog.so $out/lib
105     mkdir -pv $out/bin
106     cp src/mudlet $out
107     mkdir -pv $out/share/mudlet
108     cp -r ../src/mudlet-lua/lua $out/share/mudlet/
110     mkdir -pv $out/share/applications
111     cp ../mudlet.desktop $out/share/applications/
113     mkdir -pv $out/share/pixmaps
114     cp -r ../mudlet.png $out/share/pixmaps/
116     cp -r ../translations $out/share/
118     makeQtWrapper $out/mudlet $out/bin/mudlet \
119       --set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \
120       --prefix LUA_PATH : "$NIX_LUA_PATH" \
121       --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsForQt5.qtkeychain discord-rpc ]}" \
122       --chdir "$out";
124     runHook postInstall
125   '';
127   meta = with lib; {
128     description = "Crossplatform mud client";
129     homepage = "https://www.mudlet.org/";
130     maintainers = with maintainers; [ wyvie pstn cpu ];
131     platforms = platforms.linux;
132     license = licenses.gpl2Plus;
133   };