nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 alsa-lib,
6 atk,
7 cairo,
8 cups,
9 udev,
10 libdrm,
11 libgbm,
12 dbus,
13 expat,
14 fontconfig,
15 freetype,
16 gdk-pixbuf,
17 glib,
18 gtk3,
19 libappindicator-gtk3,
20 libnotify,
21 nspr,
22 nss,
23 pango,
24 systemd,
25 libxtst,
26 libxscrnsaver,
27 libxrender,
28 libxrandr,
29 libxi,
30 libxfixes,
31 libxext,
32 libxdamage,
33 libxcursor,
34 libxcomposite,
35 libx11,
36 libxcb,
37 autoPatchelfHook,
38 wrapGAppsHook3,
39 runtimeShell,
40 gsettings-desktop-schemas,
41}:
42
43let
44 versionSuffix = "20250428154451.19f9cfeddb";
45in
46
47stdenv.mkDerivation rec {
48 pname = "keybase-gui";
49 version = "6.5.1"; # Find latest version and versionSuffix from https://prerelease.keybase.io/deb/dists/stable/main/binary-amd64/Packages
50
51 src = fetchurl {
52 url = "https://s3.amazonaws.com/prerelease.keybase.io/linux_binaries/deb/keybase_${version + "-" + versionSuffix}_amd64.deb";
53 hash = "sha256-PCKi1lavGwLbCoMTMG4h6PJTIzwRAu542eYqDDKzU4Y=";
54 };
55
56 nativeBuildInputs = [
57 autoPatchelfHook
58 wrapGAppsHook3
59 ];
60
61 buildInputs = [
62 alsa-lib
63 atk
64 cairo
65 cups
66 dbus
67 expat
68 fontconfig
69 freetype
70 gdk-pixbuf
71 glib
72 gsettings-desktop-schemas
73 gtk3
74 libappindicator-gtk3
75 libnotify
76 nspr
77 nss
78 pango
79 systemd
80 libx11
81 libxscrnsaver
82 libxcomposite
83 libxcursor
84 libxdamage
85 libxext
86 libxfixes
87 libxi
88 libxrandr
89 libxrender
90 libxtst
91 libxcb
92 libdrm
93 libgbm
94 ];
95
96 runtimeDependencies = [
97 (lib.getLib udev)
98 libappindicator-gtk3
99 ];
100
101 dontBuild = true;
102 dontConfigure = true;
103 dontPatchELF = true;
104
105 unpackPhase = ''
106 ar xf $src
107 tar xf data.tar.xz
108 '';
109
110 installPhase = ''
111 mkdir -p $out/bin
112 mv usr/share $out/share
113 mv opt/keybase $out/share/
114
115 cat > $out/bin/keybase-gui <<EOF
116 #!${runtimeShell}
117
118 checkFailed() {
119 if [ "\$NIX_SKIP_KEYBASE_CHECKS" = "1" ]; then
120 return
121 fi
122 echo "Set NIX_SKIP_KEYBASE_CHECKS=1 if you want to skip this check." >&2
123 exit 1
124 }
125
126 if [ ! -S "\$XDG_RUNTIME_DIR/keybase/keybased.sock" ]; then
127 echo "Keybase service doesn't seem to be running." >&2
128 echo "You might need to run: keybase service" >&2
129 checkFailed
130 fi
131
132 if [ -z "\$(keybase status | grep kbfsfuse)" ]; then
133 echo "Could not find kbfsfuse client in keybase status." >&2
134 echo "You might need to run: kbfsfuse" >&2
135 checkFailed
136 fi
137
138 exec $out/share/keybase/Keybase \''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}} "\$@"
139 EOF
140 chmod +x $out/bin/keybase-gui
141
142 substituteInPlace $out/share/applications/keybase.desktop \
143 --replace run_keybase $out/bin/keybase-gui
144 '';
145
146 meta = {
147 homepage = "https://www.keybase.io/";
148 description = "Keybase official GUI";
149 mainProgram = "keybase-gui";
150 platforms = [ "x86_64-linux" ];
151 maintainers = with lib.maintainers; [
152 avaq
153 rvolosatovs
154 puffnfresh
155 np
156 shofius
157 ryand56
158 ];
159 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
160 license = lib.licenses.bsd3;
161 };
162}