lol
1{ stdenv
2, lib
3, fetchurl
4, glib
5, meson
6, ninja
7, pkg-config
8, gettext
9, libxslt
10, python3
11, docbook-xsl-nons
12, docbook_xml_dtd_42
13, libgcrypt
14, gobject-introspection
15, vala
16, gi-docgen
17, gnome
18, gjs
19, libintl
20, dbus
21}:
22
23stdenv.mkDerivation rec {
24 pname = "libsecret";
25 version = "0.20.5";
26
27 outputs = [ "out" "dev" "devdoc" ];
28
29 src = fetchurl {
30 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
31 sha256 = "P7PONA/NfbVNh8iT5pv8Kx9uTUsnkGX/5m2snw/RK00=";
32 };
33
34 depsBuildBuild = [
35 pkg-config
36 ];
37
38 nativeBuildInputs = [
39 meson
40 ninja
41 pkg-config
42 gettext
43 libxslt # for xsltproc for building man pages
44 docbook-xsl-nons
45 docbook_xml_dtd_42
46 libintl
47 gobject-introspection
48 vala
49 gi-docgen
50 glib
51 ];
52
53 buildInputs = [
54 libgcrypt
55 gobject-introspection
56 ];
57
58 propagatedBuildInputs = [
59 glib
60 ];
61
62 checkInputs = [
63 python3
64 python3.pkgs.dbus-python
65 python3.pkgs.pygobject3
66 dbus
67 gjs
68 ];
69
70 doCheck = stdenv.isLinux;
71
72 postPatch = ''
73 patchShebangs ./tool/test-*.sh
74 '';
75
76 preCheck = ''
77 # Our gobject-introspection patches make the shared library paths absolute
78 # in the GIR files. When running tests, the library is not yet installed,
79 # though, so we need to replace the absolute path with a local one during build.
80 # We are using a symlink that will be overwitten during installation.
81 mkdir -p $out/lib $out/lib
82 ln -s "$PWD/libsecret/libmock-service.so" "$out/lib/libmock-service.so"
83 ln -s "$PWD/libsecret/libsecret-1.so.0" "$out/lib/libsecret-1.so.0"
84 '';
85
86 checkPhase = ''
87 runHook preCheck
88
89 dbus-run-session \
90 --config-file=${dbus.daemon}/share/dbus-1/session.conf \
91 meson test --print-errorlogs
92
93 runHook postCheck
94 '';
95
96 postCheck = ''
97 # This is test-only so it won’t be overwritten during installation.
98 rm "$out/lib/libmock-service.so"
99 '';
100
101 postFixup = ''
102 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
103 moveToOutput "share/doc" "$devdoc"
104 '';
105
106 passthru = {
107 updateScript = gnome.updateScript {
108 packageName = pname;
109 # Does not seem to use the odd-unstable policy: https://gitlab.gnome.org/GNOME/libsecret/issues/30
110 versionPolicy = "none";
111 };
112 };
113
114 meta = {
115 description = "A library for storing and retrieving passwords and other secrets";
116 homepage = "https://wiki.gnome.org/Projects/Libsecret";
117 license = lib.licenses.lgpl21Plus;
118 mainProgram = "secret-tool";
119 inherit (glib.meta) platforms maintainers;
120 };
121}