base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / tools / security / keybase / gui.nix
blob3beeaac77b2801ad0d8686043a826e8df573c8d0
1 { stdenv, lib, fetchurl, alsa-lib, atk, cairo, cups, udev, libdrm, mesa
2 , dbus, expat, fontconfig, freetype, gdk-pixbuf, glib, gtk3, libappindicator-gtk3
3 , libnotify, nspr, nss, pango, systemd, xorg, autoPatchelfHook, wrapGAppsHook3
4 , runtimeShell, gsettings-desktop-schemas }:
6 let
7   versionSuffix = "20240821175720.3212f60cc5";
8 in
10 stdenv.mkDerivation rec {
11   pname = "keybase-gui";
12   version = "6.4.0"; # Find latest version and versionSuffix from https://prerelease.keybase.io/deb/dists/stable/main/binary-amd64/Packages
14   src = fetchurl {
15     url = "https://s3.amazonaws.com/prerelease.keybase.io/linux_binaries/deb/keybase_${version + "-" + versionSuffix}_amd64.deb";
16     hash = "sha256-OGuckMUXDzfHIMhQagYJZObV4W6LufqTeIiCg+c5MjM=";
17   };
19   nativeBuildInputs = [
20     autoPatchelfHook
21     wrapGAppsHook3
22   ];
24   buildInputs = [
25     alsa-lib
26     atk
27     cairo
28     cups
29     dbus
30     expat
31     fontconfig
32     freetype
33     gdk-pixbuf
34     glib
35     gsettings-desktop-schemas
36     gtk3
37     libappindicator-gtk3
38     libnotify
39     nspr
40     nss
41     pango
42     systemd
43     xorg.libX11
44     xorg.libXScrnSaver
45     xorg.libXcomposite
46     xorg.libXcursor
47     xorg.libXdamage
48     xorg.libXext
49     xorg.libXfixes
50     xorg.libXi
51     xorg.libXrandr
52     xorg.libXrender
53     xorg.libXtst
54     xorg.libxcb
55     libdrm
56     mesa.out
57   ];
59   runtimeDependencies = [
60     (lib.getLib udev)
61     libappindicator-gtk3
62   ];
64   dontBuild = true;
65   dontConfigure = true;
66   dontPatchELF = true;
68   unpackPhase = ''
69     ar xf $src
70     tar xf data.tar.xz
71   '';
73   installPhase = ''
74     mkdir -p $out/bin
75     mv usr/share $out/share
76     mv opt/keybase $out/share/
78     cat > $out/bin/keybase-gui <<EOF
79     #!${runtimeShell}
81     checkFailed() {
82       if [ "\$NIX_SKIP_KEYBASE_CHECKS" = "1" ]; then
83         return
84       fi
85       echo "Set NIX_SKIP_KEYBASE_CHECKS=1 if you want to skip this check." >&2
86       exit 1
87     }
89     if [ ! -S "\$XDG_RUNTIME_DIR/keybase/keybased.sock" ]; then
90       echo "Keybase service doesn't seem to be running." >&2
91       echo "You might need to run: keybase service" >&2
92       checkFailed
93     fi
95     if [ -z "\$(keybase status | grep kbfsfuse)" ]; then
96       echo "Could not find kbfsfuse client in keybase status." >&2
97       echo "You might need to run: kbfsfuse" >&2
98       checkFailed
99     fi
101     exec $out/share/keybase/Keybase \''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}} "\$@"
102     EOF
103     chmod +x $out/bin/keybase-gui
105     substituteInPlace $out/share/applications/keybase.desktop \
106       --replace run_keybase $out/bin/keybase-gui
107   '';
109   meta = with lib; {
110     homepage = "https://www.keybase.io/";
111     description = "Keybase official GUI";
112     mainProgram = "keybase-gui";
113     platforms = [ "x86_64-linux" ];
114     maintainers = with maintainers; [ avaq rvolosatovs puffnfresh np Br1ght0ne shofius ryand56 ];
115     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
116     license = licenses.bsd3;
117   };