@@ -0,0 +1,86 @@
1+{ stdenv, fetchurl, dpkg
2+, alsaLib, atk, cairo, cups, curl, dbus, expat, fontconfig, freetype, glib
3+, gnome2, libnotify, libxcb, nspr, nss, systemd, xorg }:
4+
5+let
6+
7+ version = "1.13.1";
8+
9+ rpath = stdenv.lib.makeLibraryPath [
10+ alsaLib
11+ atk
12+ cairo
13+ cups
14+ curl
15+ dbus
16+ expat
17+ fontconfig
18+ freetype
19+ glib
20+ gnome2.GConf
21+ gnome2.gdk_pixbuf
22+ gnome2.gtk
23+ gnome2.pango
24+ libnotify
25+ libxcb
26+ nspr
27+ nss
28+ stdenv.cc.cc
29+ systemd
30+
31+ xorg.libxkbfile
32+ xorg.libX11
33+ xorg.libXcomposite
34+ xorg.libXcursor
35+ xorg.libXdamage
36+ xorg.libXext
37+ xorg.libXfixes
38+ xorg.libXi
39+ xorg.libXrandr
40+ xorg.libXrender
41+ xorg.libXtst
42+ xorg.libXScrnSaver
43+ ] + ":${stdenv.cc.cc.lib}/lib64";
44+
45+ src =
46+ if stdenv.system == "x86_64-linux" then
47+ fetchurl {
48+ url = "https://downloads.mongodb.com/compass/mongodb-compass_${version}_amd64.deb";
49+ sha256 = "0x23jshnr0rafm5sn2vhq2y2gryg8mksahzyv5fszblgaxay234p";
50+ }
51+ else
52+ throw "MongoDB compass is not supported on ${stdenv.system}";
53+
54+in stdenv.mkDerivation {
55+ name = "mongodb-compass-${version}";
56+
57+ inherit src;
58+
59+ buildInputs = [ dpkg ];
60+ unpackPhase = "true";
61+
62+ buildCommand = ''
63+ IFS=$'\n'
64+ dpkg -x $src $out
65+ cp -av $out/usr/* $out
66+ rm -rf $out/share/lintian
67+ #The node_modules are bringing in non-linux files/dependencies
68+ find $out -name "*.app" -exec rm -rf {} \; || true
69+ find $out -name "*.dll" -delete
70+ find $out -name "*.exe" -delete
71+ # Otherwise it looks "suspicious"
72+ chmod -R g-w $out
73+ for file in `find $out -type f -perm /0111 -o -name \*.so\*`; do
74+ echo "Manipulating file: $file"
75+ patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
76+ patchelf --set-rpath ${rpath}:$out/share/mongodb-compass "$file" || true
77+ done
78+ '';
79+
80+ meta = with stdenv.lib; {
81+ description = "The GUI for MongoDB";
82+ homepage = https://www.mongodb.com/products/compass;
83+ license = licenses.unfree;
84+ platforms = [ "x86_64-linux" ];
85+ };
86+}