1{ lib
2, stdenv
3, fetchFromGitLab
4, fetchpatch
5, appstream-glib
6, desktop-file-utils
7, meson
8, ninja
9, pkg-config
10, python3
11, rustPlatform
12, wrapGAppsHook
13, gdk-pixbuf
14, glib
15, gst_all_1
16, gtk4
17, libadwaita
18, openssl
19, sqlite
20, wayland
21, zbar
22}:
23
24stdenv.mkDerivation rec {
25 pname = "authenticator";
26 version = "4.0.3";
27
28 src = fetchFromGitLab {
29 domain = "gitlab.gnome.org";
30 owner = "World";
31 repo = "Authenticator";
32 rev = version;
33 sha256 = "0fvs76f3fm5pxn7wg6sjbqpgip5w2j7xrh4siasdcl2bx6vsld8b";
34 };
35
36 cargoDeps = rustPlatform.fetchCargoTarball {
37 inherit src;
38 name = "${pname}-${version}";
39 sha256 = "1s97jyszxf24rs3ni11phiyvmp1wm8sicb0rh1jgwz4bn1cnakx4";
40 };
41
42 postPatch = ''
43 patchShebangs build-aux
44 '';
45
46 nativeBuildInputs = [
47 appstream-glib
48 desktop-file-utils
49 meson
50 ninja
51 pkg-config
52 python3
53 wrapGAppsHook
54 ] ++ (with rustPlatform; [
55 cargoSetupHook
56 rust.cargo
57 rust.rustc
58 ]);
59
60 buildInputs = [
61 gdk-pixbuf
62 glib
63 gst_all_1.gstreamer
64 gst_all_1.gst-plugins-base
65
66 # gst-plugins-good needs gtk4 support:
67 # https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/767
68 # We copy the way it is built from the Flatpak:
69 # https://gitlab.gnome.org/World/Authenticator/-/blob/master/build-aux/com.belmoussaoui.Authenticator.Devel.json
70 (gst_all_1.gst-plugins-good.overrideAttrs (old: {
71 patches = old.patches or [ ] ++ [
72 "${src}/build-aux/767.patch"
73 ];
74 mesonFlags = old.mesonFlags ++ [
75 "-Dgtk3=disabled"
76 "-Dgtk4=enabled"
77 "-Dgtk4-experiments=true"
78 ];
79 buildInputs = old.buildInputs ++ [
80 gtk4
81 ];
82 }))
83
84 (gst_all_1.gst-plugins-bad.override { enableZbar = true; })
85 gtk4
86 libadwaita
87 openssl
88 sqlite
89 wayland
90 zbar
91 ];
92
93 meta = with lib; {
94 broken = true; # https://gitlab.gnome.org/World/Authenticator/-/issues/271
95 description = "Two-factor authentication code generator for GNOME";
96 homepage = "https://gitlab.gnome.org/World/Authenticator";
97 license = licenses.gpl3Plus;
98 maintainers = with maintainers; [ dotlambda ];
99 };
100}