Skip to content

Instantly share code, notes, and snippets.

@tstelzer
Created May 7, 2020 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tstelzer/aa700c26b7262cd1759674e191665a04 to your computer and use it in GitHub Desktop.
Save tstelzer/aa700c26b7262cd1759674e191665a04 to your computer and use it in GitHub Desktop.
{ stdenv, fetchurl, dpkg , alsaLib, atk, cairo, cups, curl, dbus, expat,
fontconfig, freetype, glib , gnome2, gnome3, libnotify, libxcb, nspr, nss,
systemd, xorg, wrapGAppsHook, at-spi2-atk, libsecret }:
let
version = "1.20.5";
rpath = stdenv.lib.makeLibraryPath [
alsaLib
atk
at-spi2-atk
libsecret
cairo
cups
curl
dbus
expat
fontconfig
freetype
glib
gnome2.GConf
gnome2.gdk_pixbuf
gnome3.gtk
gnome3.defaultIconTheme
gnome2.pango
libnotify
libxcb
nspr
nss
stdenv.cc.cc
systemd
xorg.libxkbfile
xorg.libX11
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXtst
xorg.libXScrnSaver
] + ":${stdenv.cc.cc.lib}/lib64";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
url = "https://downloads.mongodb.com/compass/mongodb-compass_${version}_amd64.deb";
sha256 = "0rvllffnvycl6iigv4in6am76fh9pq2k6z01npfnbbzpn34r71wa";
}
else
throw "MongoDB compass is not supported on ${stdenv.hostPlatform.system}";
in stdenv.mkDerivation {
pname = "mongodb-compass";
inherit version;
inherit src;
buildInputs = [ dpkg wrapGAppsHook gnome3.gtk ];
dontUnpack = true;
buildCommand = ''
IFS=$'\n'
dpkg -x $src $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/share/mongodb-compass "$file" || true
done
wrapGAppsHook \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--suffix XDG_DATA_DIRS : '${gnome3.defaultIconTheme}/share' \
$out/bin/mongodb-compass
'';
meta = with stdenv.lib; {
description = "The GUI for MongoDB";
homepage = https://www.mongodb.com/products/compass;
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment