1{
2 # Packaging Dependencies
3 lib, stdenv, requireFile, autoPatchelfHook, unzip, copyDesktopItems, makeDesktopItem,
4
5 # Everspace Dependencies
6 cairo, gdk-pixbuf, pango, gtk2-x11, libGL, openal,
7
8 # Unreal Engine 4 Dependencies
9 xorg
10}:
11
12# Known issues:
13# - Video playback (upon starting a new game) does not work (screen is black)
14stdenv.mkDerivation rec {
15 pname = "everspace";
16 version = "1.3.5.3655";
17
18 src = requireFile {
19 name = "everspace_1_3_5_3655_32896.sh";
20 url = "https://www.gog.com/";
21 sha256 = "0jlvxq14k1pxmbr08y8kar0ijlqxcnkfqlvw883j96v9zr34ynj3";
22 };
23
24 nativeBuildInputs = [
25 autoPatchelfHook
26 copyDesktopItems
27 unzip
28 ];
29
30 buildInputs = [
31 cairo
32 gdk-pixbuf
33 pango
34 gtk2-x11
35 openal
36 stdenv.cc.cc.lib
37 ];
38
39 runtimeDependencies = [
40 libGL
41
42 # ue4
43 xorg.libX11
44 xorg.libXScrnSaver
45 xorg.libXau
46 xorg.libXcursor
47 xorg.libXext
48 xorg.libXfixes
49 xorg.libXi
50 xorg.libXrandr
51 xorg.libXrender
52 xorg.libXxf86vm
53 xorg.libxcb
54 ];
55
56 unpackPhase = ''
57 runHook preUnpack
58
59 # The shell script contains a zip file. Unzipping it works but will result
60 # in some error output and an error exit code.
61 unzip "$src" || true
62
63 runHook postUnpack
64 '';
65
66 postPatch = ''
67 ## Remove Bundled Libs ##
68
69 # vlc libs
70 #
71 # TODO: This is probably what breaks video playback. It would be cleaner
72 # to remove the bundled libs and replace them with system libs but there
73 # are so many. Copy-pasting the list from the vlc package is a good start
74 # but still leaves us with many unresolved dependencies.
75 rm -rf ./data/noarch/game/RSG/Plugins/VlcMedia
76
77 # openal
78 rm -rf ./data/noarch/game/Engine/Binaries/ThirdParty/OpenAL
79 '';
80
81 dontConfigure = true;
82 dontBuild = true;
83
84 installPhase = ''
85 runHook preInstall
86
87 mkdir -p "$out/opt"
88 cp -r "./data/noarch" "$out/opt/everspace"
89
90 mkdir -p "$out/bin"
91 ln -s "$out/opt/everspace/game/RSG/Binaries/Linux/RSG-Linux-Shipping" "$out/bin/everspace"
92
93 mkdir -p "$out/share/pixmaps"
94 ln -s "$out/opt/everspace/support/icon.png" "$out/share/pixmaps/everspace-gog.png"
95
96 runHook postInstall
97 '';
98
99 desktopItems = [
100 (makeDesktopItem {
101 type = "Application";
102 name = "everspace-gog";
103 desktopName = "EVERSPACE™";
104 comment = meta.description;
105 exec = "everspace";
106 icon = "everspace-gog";
107 categories = [ "Game" ];
108 })
109 ];
110
111 meta = with lib; {
112 description = "Action-focused single-player space shooter with roguelike elements";
113 homepage = "https://classic.everspace-game.com/";
114 license = licenses.unfree;
115 maintainers = with maintainers; [ jtrees ];
116 platforms = [ "x86_64-linux" ];
117 };
118}