core/pkgs/by-name/li/libsecret/default.nix

102 lines
2.9 KiB
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ stdenv, lib, fetchurl, glib, meson, ninja, pkg-config, gettext, libxslt
, python3, docbook-xsl-nons, docbook_xml_dtd_42, libgcrypt
, gobject-introspection, buildPackages, withIntrospection ?
lib.meta.availableOn stdenv.hostPlatform gobject-introspection
&& stdenv.hostPlatform.emulatorAvailable buildPackages, vala, gi-docgen, gnome
, gjs, libintl, dbus }:
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation rec {
pname = "libsecret";
version = "0.21.4";
outputs = [ "out" "dev" ] ++ lib.optional withIntrospection "devdoc";
src = fetchurl {
2024-05-13 21:24:10 +00:00
url = "mirror://gnome/sources/${pname}/${
lib.versions.majorMinor version
}/${pname}-${version}.tar.xz";
2024-05-02 00:46:19 +00:00
hash = "sha256-Fj0I14O+bUq5qXnOtaT+y8HZZg08NBaMWBMBzVORKyA=";
};
2024-05-13 21:24:10 +00:00
depsBuildBuild = [ pkg-config ];
2024-05-02 00:46:19 +00:00
nativeBuildInputs = [
meson
ninja
pkg-config
gettext
libxslt # for xsltproc for building man pages
docbook-xsl-nons
docbook_xml_dtd_42
libintl
vala
glib
2024-05-13 21:24:10 +00:00
] ++ lib.optionals withIntrospection [ gi-docgen gobject-introspection ];
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
buildInputs = [ libgcrypt ];
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
propagatedBuildInputs = [ glib ];
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
nativeCheckInputs =
[ python3 python3.pkgs.dbus-python python3.pkgs.pygobject3 dbus gjs ];
2024-05-02 00:46:19 +00:00
mesonFlags = [
(lib.mesonBool "introspection" withIntrospection)
(lib.mesonBool "gtk_doc" withIntrospection)
];
doCheck = stdenv.isLinux && withIntrospection;
separateDebugInfo = true;
postPatch = ''
patchShebangs ./tool/test-*.sh
'';
preCheck = ''
# Our gobject-introspection patches make the shared library paths absolute
# in the GIR files. When running tests, the library is not yet installed,
# though, so we need to replace the absolute path with a local one during build.
# We are using a symlink that will be overwitten during installation.
mkdir -p $out/lib $out/lib
ln -s "$PWD/libsecret/libmock-service.so" "$out/lib/libmock-service.so"
ln -s "$PWD/libsecret/libsecret-1.so.0" "$out/lib/libsecret-1.so.0"
'';
checkPhase = ''
runHook preCheck
dbus-run-session \
--config-file=${dbus}/share/dbus-1/session.conf \
meson test --print-errorlogs --timeout-multiplier 0
runHook postCheck
'';
postCheck = ''
# This is test-only so it wont be overwritten during installation.
rm "$out/lib/libmock-service.so"
'';
postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc"
'';
passthru = {
updateScript = gnome.updateScript {
packageName = pname;
# Does not seem to use the odd-unstable policy: https://gitlab.gnome.org/GNOME/libsecret/issues/30
versionPolicy = "none";
};
};
meta = {
2024-05-13 21:24:10 +00:00
description =
"A library for storing and retrieving passwords and other secrets";
2024-05-02 00:46:19 +00:00
homepage = "https://gitlab.gnome.org/GNOME/libsecret";
license = lib.licenses.lgpl21Plus;
mainProgram = "secret-tool";
inherit (glib.meta) platforms maintainers;
};
}