3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/security/keybase/gui.nix
Jon Banafato 6c5bf24d1d keybase-gui: 1.0.44 -> 2.3.0
Upgrade keybase-gui to the latest release.
2018-06-28 11:57:49 -04:00

98 lines
2.4 KiB
Nix

{ stdenv, fetchurl, buildFHSUserEnv, writeTextFile, alsaLib, atk, cairo, cups
, dbus, expat, fontconfig, freetype, gcc, gdk_pixbuf, glib, gnome2, gtk3
, libnotify, nspr, nss, pango, systemd, xorg, utillinuxMinimal }:
let
libPath = stdenv.lib.makeLibraryPath [
alsaLib
atk
cairo
cups
dbus
expat
fontconfig
freetype
gcc.cc
gdk_pixbuf
glib
gnome2.GConf
gtk3
libnotify
nspr
nss
pango
systemd
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXScrnSaver
xorg.libXtst
];
in
stdenv.mkDerivation rec {
name = "keybase-gui-${version}";
version = "2.3.0-20180627160031.8e0438e6fb";
src = fetchurl {
url = "https://s3.amazonaws.com/prerelease.keybase.io/linux_binaries/deb/keybase_${version}_amd64.deb";
sha256 = "0xaxxjdfdmgv0wfy75dspfa0a7cdwdpphyy6my9vw82v8jxl3ffx";
};
phases = ["unpackPhase" "installPhase" "fixupPhase"];
unpackPhase = ''
ar xf $src
tar xf data.tar.xz
'';
installPhase = ''
mkdir -p $out/bin
mv usr/share $out/share
mv opt/keybase $out/share/
cat > $out/bin/keybase-gui <<EOF
#!${stdenv.shell}
checkFailed() {
if [ "\$NIX_SKIP_KEYBASE_CHECKS" = "1" ]; then
return
fi
echo "Set NIX_SKIP_KEYBASE_CHECKS=1 if you want to skip this check." >&2
exit 1
}
if [ ! -S "\$XDG_RUNTIME_DIR/keybase/keybased.sock" ]; then
echo "Keybase service doesn't seem to be running." >&2
echo "You might need to run: keybase service" >&2
checkFailed
fi
${utillinuxMinimal}/bin/mountpoint /keybase &>/dev/null
if [ "\$?" -ne "0" ]; then
echo "Keybase is not mounted to /keybase." >&2
echo "You might need to run: kbfsfuse /keybase" >&2
checkFailed
fi
exec $out/share/keybase/Keybase "\$@"
EOF
chmod +x $out/bin/keybase-gui
substituteInPlace $out/share/applications/keybase.desktop \
--replace run_keybase $out/bin/keybase-gui
'';
postFixup = ''
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "${libPath}:\$ORIGIN" "$out/share/keybase/Keybase"
'';
meta = with stdenv.lib; {
homepage = https://www.keybase.io/;
description = "The Keybase official GUI.";
platforms = platforms.linux;
maintainers = with maintainers; [ puffnfresh np ];
};
}