nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitLab
4, docbook-xsl-nons
5, gi-docgen
6, gtk-doc
7, libxml2
8, meson
9, ninja
10, pkg-config
11, sassc
12, vala
13, gobject-introspection
14, fribidi
15, glib
16, gtk4
17, gnome
18, gsettings-desktop-schemas
19, xvfb-run
20}:
21
22stdenv.mkDerivation rec {
23 pname = "libadwaita";
24 version = "1.1.1";
25
26 outputs = [ "out" "dev" "devdoc" ];
27 outputBin = "devdoc"; # demo app
28
29 src = fetchFromGitLab {
30 domain = "gitlab.gnome.org";
31 owner = "GNOME";
32 repo = "libadwaita";
33 rev = version;
34 hash = "sha256-iCMCQyhCUhp1f20+Qost9nnmfIUFE0iLKMKT/PfwOd4=";
35 };
36
37 nativeBuildInputs = [
38 docbook-xsl-nons
39 gi-docgen
40 gtk-doc
41 libxml2 # for xmllint
42 meson
43 ninja
44 pkg-config
45 sassc
46 vala
47 ];
48
49 mesonFlags = [
50 "-Dgtk_doc=true"
51 ];
52
53 buildInputs = [
54 fribidi
55 gobject-introspection
56 ];
57
58 propagatedBuildInputs = [
59 gtk4
60 ];
61
62 checkInputs = [
63 gnome.adwaita-icon-theme
64 xvfb-run
65 ];
66
67 doCheck = true;
68
69 checkPhase = ''
70 runHook preCheck
71
72 testEnvironment=(
73 # Disable portal since we cannot run it in tests.
74 ADW_DISABLE_PORTAL=1
75
76 # AdwSettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme.
77 # It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name.
78 # See adw_settings_constructed function in https://gitlab.gnome.org/GNOME/libadwaita/commit/60ec69f0a5d49cad8a6d79e4ecefd06dc6e3db12
79 "XDG_DATA_DIRS=${glib.getSchemaDataDirPath gsettings-desktop-schemas}"
80
81 # Tests need a cache directory
82 "HOME=$TMPDIR"
83 )
84 env "''${testEnvironment[@]}" xvfb-run \
85 meson test --print-errorlogs
86
87 runHook postCheck
88 '';
89
90 postInstall = ''
91 mv $out/share/{doc,gtk-doc}
92 '';
93
94 passthru = {
95 updateScript = gnome.updateScript {
96 packageName = pname;
97 };
98 };
99
100 meta = with lib; {
101 description = "Library to help with developing UI for mobile devices using GTK/GNOME";
102 homepage = "https://gitlab.gnome.org/GNOME/libadwaita";
103 license = licenses.lgpl21Plus;
104 maintainers = teams.gnome.members ++ (with maintainers; [ dotlambda ]);
105 platforms = platforms.linux;
106 };
107}