nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 buildFHSEnv,
6 copyDesktopItems,
7 makeDesktopItem,
8 makeWrapper,
9 alsa-lib,
10 at-spi2-atk,
11 cairo,
12 cups,
13 dbus,
14 expat,
15 gdk-pixbuf,
16 glib,
17 gtk3,
18 libgbm,
19 libGL,
20 nss,
21 nspr,
22 libdrm,
23 libxrandr,
24 libxfixes,
25 libxext,
26 libxdamage,
27 libxcomposite,
28 libx11,
29 libxkbfile,
30 libxcb,
31 libxkbcommon,
32 libxshmfence,
33 pango,
34 systemd,
35 icu,
36 openssl,
37 zlib,
38 bintools,
39}:
40let
41 pname = "sidequest";
42 version = "0.10.42";
43
44 sidequest = stdenv.mkDerivation {
45 inherit pname version;
46
47 src = fetchurl {
48 url = "https://github.com/SideQuestVR/SideQuest/releases/download/v${version}/SideQuest-${version}.tar.xz";
49 hash = "sha256-YZp7OAjUOXepVv5dPhh9Q2HicUKjSOGfhrWyMKy2gME=";
50 };
51
52 nativeBuildInputs = [
53 copyDesktopItems
54 makeWrapper
55 ];
56
57 desktopItems = [
58 (makeDesktopItem {
59 name = "sidequest";
60 exec = "sidequest";
61 icon = "sidequest";
62 desktopName = "SideQuest";
63 genericName = "VR App Store";
64 categories = [
65 "Settings"
66 "PackageManager"
67 ];
68 })
69 ];
70
71 installPhase = ''
72 runHook preInstall
73
74 mkdir -p "$out/libexec" "$out/bin"
75 cp --recursive . "$out/libexec/sidequest"
76 ln -s "$out/libexec/sidequest/sidequest" "$out/bin/sidequest"
77 for size in 16 24 32 48 64 128 256 512 1024; do
78 install -D --mode=0644 resources/app.asar.unpacked/build/icons/''${size}x''${size}.png $out/share/icons/hicolor/''${size}x''${size}/apps/sidequest.png
79 done
80
81 runHook postInstall
82 '';
83
84 postFixup = ''
85 patchelf \
86 --set-interpreter "${bintools.dynamicLinker}" \
87 --set-rpath "${
88 lib.makeLibraryPath [
89 alsa-lib
90 at-spi2-atk
91 cairo
92 cups
93 dbus
94 expat
95 gdk-pixbuf
96 glib
97 gtk3
98 libgbm
99 libGL
100 nss
101 nspr
102 libdrm
103 libx11
104 libxcb
105 libxcomposite
106 libxdamage
107 libxext
108 libxfixes
109 libxrandr
110 libxshmfence
111 libxkbcommon
112 libxkbfile
113 pango
114 (lib.getLib stdenv.cc.cc)
115 systemd
116 ]
117 }:$out/libexec/sidequest" \
118 --add-needed libGL.so.1 \
119 "$out/libexec/sidequest/sidequest"
120 '';
121 };
122in
123buildFHSEnv {
124 inherit pname version;
125
126 targetPkgs = pkgs: [
127 sidequest
128 # Needed in the environment on runtime, to make QuestSaberPatch work
129 icu
130 openssl
131 zlib
132 libxkbcommon
133 libxshmfence
134 ];
135
136 extraInstallCommands = ''
137 ln -s ${sidequest}/share "$out/share"
138 '';
139
140 runScript = "sidequest";
141
142 meta = {
143 description = "Open app store and side-loading tool for Android-based VR devices such as the Oculus Go, Oculus Quest or Moverio BT 300";
144 homepage = "https://github.com/SideQuestVR/SideQuest";
145 downloadPage = "https://github.com/SideQuestVR/SideQuest/releases";
146 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
147 license = lib.licenses.mit;
148 maintainers = with lib.maintainers; [
149 joepie91
150 rvolosatovs
151 ];
152 platforms = [ "x86_64-linux" ];
153 mainProgram = "SideQuest";
154 };
155}