about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/keybase/gui.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/keybase/gui.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/keybase/gui.nix116
1 files changed, 116 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/keybase/gui.nix b/nixpkgs/pkgs/tools/security/keybase/gui.nix
new file mode 100644
index 000000000000..8912961e3520
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/keybase/gui.nix
@@ -0,0 +1,116 @@
+{ stdenv, lib, fetchurl, alsa-lib, atk, cairo, cups, udev, libdrm, mesa
+, dbus, expat, fontconfig, freetype, gdk-pixbuf, glib, gtk3, libappindicator-gtk3
+, libnotify, nspr, nss, pango, systemd, xorg, autoPatchelfHook, wrapGAppsHook
+, runtimeShell, gsettings-desktop-schemas }:
+
+let
+  versionSuffix = "20210930160723.fefa22edc1";
+in
+
+stdenv.mkDerivation rec {
+  pname = "keybase-gui";
+  version = "5.8.1"; # Find latest version from https://prerelease.keybase.io/deb/dists/stable/main/binary-amd64/Packages
+
+  src = fetchurl {
+    url = "https://s3.amazonaws.com/prerelease.keybase.io/linux_binaries/deb/keybase_${version + "-" + versionSuffix}_amd64.deb";
+    sha256 = "cqbGvnJ6wx5boVe78Ju8CimH1H08DfkM5nmwbV0uKG0=";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    alsa-lib
+    atk
+    cairo
+    cups
+    dbus
+    expat
+    fontconfig
+    freetype
+    gdk-pixbuf
+    glib
+    gsettings-desktop-schemas
+    gtk3
+    libappindicator-gtk3
+    libnotify
+    nspr
+    nss
+    pango
+    systemd
+    xorg.libX11
+    xorg.libXScrnSaver
+    xorg.libXcomposite
+    xorg.libXcursor
+    xorg.libXdamage
+    xorg.libXext
+    xorg.libXfixes
+    xorg.libXi
+    xorg.libXrandr
+    xorg.libXrender
+    xorg.libXtst
+    xorg.libxcb
+    libdrm
+    mesa.out
+  ];
+
+  runtimeDependencies = [
+    (lib.getLib udev)
+    libappindicator-gtk3
+  ];
+
+  dontBuild = true;
+  dontConfigure = true;
+  dontPatchELF = true;
+
+  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
+    #!${runtimeShell}
+
+    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
+
+    if [ -z "\$(keybase status | grep kbfsfuse)" ]; then
+      echo "Could not find kbfsfuse client in keybase status." >&2
+      echo "You might need to run: kbfsfuse" >&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
+  '';
+
+  meta = with lib; {
+    homepage = "https://www.keybase.io/";
+    description = "The Keybase official GUI";
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ avaq rvolosatovs puffnfresh np Br1ght0ne ];
+    license = licenses.bsd3;
+  };
+}