1{
2 stdenv,
3 lib,
4 fetchurl,
5 pkg-config,
6 meson,
7 ninja,
8 gettext,
9 gnupg,
10 p11-kit,
11 glib,
12 libgcrypt,
13 libtasn1,
14 gtk3,
15 pango,
16 libsecret,
17 openssh,
18 systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd,
19 systemd,
20 gobject-introspection,
21 wrapGAppsHook3,
22 gi-docgen,
23 vala,
24 gnome,
25 python3,
26 shared-mime-info,
27}:
28
29stdenv.mkDerivation rec {
30 pname = "gcr";
31 version = "3.41.2";
32
33 outputs = [
34 "out"
35 "dev"
36 "devdoc"
37 ];
38
39 src = fetchurl {
40 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
41 sha256 = "utEPPFU6DhhUZJq1nFskNNoiyhpUrmE48fU5YVZ+Grc=";
42 };
43
44 strictDeps = true;
45
46 nativeBuildInputs = [
47 pkg-config
48 meson
49 python3
50 ninja
51 gettext
52 gobject-introspection
53 gi-docgen
54 wrapGAppsHook3
55 vala
56 shared-mime-info
57 openssh
58 ];
59
60 buildInputs = [
61 libgcrypt
62 libtasn1
63 pango
64 libsecret
65 openssh
66 ]
67 ++ lib.optionals (systemdSupport) [
68 systemd
69 ];
70
71 propagatedBuildInputs = [
72 glib
73 gtk3
74 p11-kit
75 ];
76
77 nativeCheckInputs = [
78 python3
79 ];
80
81 mesonFlags = [
82 # We are still using ssh-agent from gnome-keyring.
83 # https://github.com/NixOS/nixpkgs/issues/140824
84 "-Dssh_agent=false"
85 "-Dgpg_path=${lib.getBin gnupg}/bin/gpg"
86 ]
87 ++ lib.optionals (!systemdSupport) [
88 "-Dsystemd=disabled"
89 ];
90
91 doCheck = false; # fails 21 out of 603 tests, needs dbus daemon
92
93 PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
94
95 postPatch = ''
96 patchShebangs gcr/fixtures/
97
98 chmod +x meson_post_install.py
99 patchShebangs meson_post_install.py
100 substituteInPlace meson_post_install.py --replace ".so" "${stdenv.hostPlatform.extensions.sharedLibrary}"
101 '';
102
103 postFixup = ''
104 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
105 moveToOutput "share/doc" "$devdoc"
106 '';
107
108 passthru = {
109 updateScript = gnome.updateScript {
110 packageName = pname;
111 freeze = true;
112 };
113 };
114
115 meta = with lib; {
116 platforms = platforms.unix;
117 teams = [ teams.gnome ];
118 description = "GNOME crypto services (daemon and tools)";
119 mainProgram = "gcr-viewer";
120 homepage = "https://gitlab.gnome.org/GNOME/gcr";
121 license = licenses.lgpl2Plus;
122
123 longDescription = ''
124 GCR is a library for displaying certificates, and crypto UI, accessing
125 key stores. It also provides the viewer for crypto files on the GNOME
126 desktop.
127
128 GCK is a library for accessing PKCS#11 modules like smart cards, in a
129 (G)object oriented way.
130 '';
131 };
132}