1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
{
alsa-lib,
at-spi2-atk,
at-spi2-core,
atk,
cairo,
cups,
curl,
dbus,
dpkg,
expat,
fetchurl,
fontconfig,
freetype,
gdk-pixbuf,
glib,
gtk3,
lib,
libdrm,
libnotify,
libsecret,
libuuid,
libxcb,
libxkbcommon,
mesa,
nspr,
nss,
pango,
stdenv,
systemd,
wrapGAppsHook3,
xorg,
}:
let
version = "1.42.5";
rpath = lib.makeLibraryPath [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
curl
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libdrm
libnotify
libsecret
libuuid
libxcb
libxkbcommon
mesa
nspr
nss
pango
stdenv.cc.cc
systemd
xorg.libX11
xorg.libXScrnSaver
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXtst
xorg.libxkbfile
xorg.libxshmfence
(lib.getLib stdenv.cc.cc)
];
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
url = "https://downloads.mongodb.com/compass/mongodb-compass_${version}_amd64.deb";
sha256 = "sha256-46JQXC2Ydq37TomtQdnvk8DwSs8aCfozxqUaEO6hmxo=";
}
else
throw "MongoDB compass is not supported on ${stdenv.hostPlatform.system}";
# NOTE While MongoDB Compass is available to darwin, I do not have resources to test it
# Feel free to make a PR adding support if desired
in stdenv.mkDerivation {
pname = "mongodb-compass";
inherit version;
inherit src;
buildInputs = [ dpkg wrapGAppsHook3 gtk3 ];
dontUnpack = true;
buildCommand = ''
IFS=$'\n'
# The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
dpkg --fsys-tarfile $src | tar --extract
mkdir -p $out
mv usr/* $out
# cp -av $out/usr/* $out
rm -rf $out/share/lintian
# The node_modules are bringing in non-linux files/dependencies
find $out -name "*.app" -exec rm -rf {} \; || true
find $out -name "*.dll" -delete
find $out -name "*.exe" -delete
# Otherwise it looks "suspicious"
chmod -R g-w $out
for file in `find $out -type f -perm /0111 -o -name \*.so\*`; do
echo "Manipulating file: $file"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
patchelf --set-rpath ${rpath}:$out/lib/mongodb-compass "$file" || true
done
wrapGAppsHook $out/bin/mongodb-compass
'';
meta = with lib; {
description = "The GUI for MongoDB";
maintainers = with maintainers; [ bryanasdev000 ];
homepage = "https://github.com/mongodb-js/compass";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.sspl;
platforms = [ "x86_64-linux" ];
mainProgram = "mongodb-compass";
};
}
|