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