lol
1{ stdenv
2, fetchurl
3, meson
4, mesonEmulatorHook
5, ninja
6, gettext
7, gtk-doc
8, pkg-config
9, vala
10, networkmanager
11, gnome
12, isocodes
13, libxml2
14, docbook_xsl
15, docbook_xml_dtd_43
16, mobile-broadband-provider-info
17, gobject-introspection
18, gtk3
19, withGtk4 ? false
20, gtk4
21, withGnome ? true
22, gcr_4
23, glib
24, lib
25, _experimental-update-script-combinators
26, makeHardcodeGsettingsPatch
27}:
28
29stdenv.mkDerivation rec {
30 pname = "libnma";
31 version = "1.10.6";
32
33 outputs = [ "out" "dev" "devdoc" ];
34
35 src = fetchurl {
36 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
37 sha256 = "U6b7KxkK03xZhsrtPpi+3nw8YCOZ7k+TyPwFQwPXbas=";
38 };
39
40 patches = [
41 # Needed for wingpanel-indicator-network and switchboard-plug-network
42 ./hardcode-gsettings.patch
43 ];
44
45 nativeBuildInputs = [
46 meson
47 ninja
48 gettext
49 pkg-config
50 gobject-introspection
51 gtk-doc
52 docbook_xsl
53 docbook_xml_dtd_43
54 libxml2
55 vala
56 ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
57 mesonEmulatorHook
58 ];
59
60 buildInputs = [
61 gtk3
62 networkmanager
63 isocodes
64 mobile-broadband-provider-info
65 ] ++ lib.optionals withGtk4 [
66 gtk4
67 ] ++ lib.optionals withGnome [
68 # advanced certificate chooser
69 gcr_4
70 ];
71
72 mesonFlags = [
73 "-Dgcr=${lib.boolToString withGnome}"
74 "-Dlibnma_gtk4=${lib.boolToString withGtk4}"
75 ];
76
77 postPatch = ''
78 substituteInPlace src/nma-ws/nma-eap.c --subst-var-by \
79 NM_APPLET_GSETTINGS ${glib.makeSchemaPath "$out" "$name"}
80 '';
81
82 postInstall = ''
83 glib-compile-schemas $out/share/glib-2.0/schemas
84 '';
85
86 passthru = {
87 hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
88 schemaIdToVariableMapping = {
89 "org.gnome.nm-applet.eap" = "NM_APPLET_GSETTINGS";
90 };
91 inherit src;
92 };
93 updateScript =
94 let
95 updateSource = gnome.updateScript {
96 packageName = "libnma";
97 versionPolicy = "odd-unstable";
98 };
99 updateGsettingsPatch = _experimental-update-script-combinators.copyAttrOutputToFile "libnma.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
100 in
101 _experimental-update-script-combinators.sequence [
102 updateSource
103 updateGsettingsPatch
104 ];
105 };
106
107 meta = with lib; {
108 homepage = "https://gitlab.gnome.org/GNOME/libnma";
109 description = "NetworkManager UI utilities (libnm version)";
110 license = licenses.gpl2Plus; # Mix of GPL and LPGL 2+
111 maintainers = teams.gnome.members;
112 platforms = platforms.linux;
113 };
114}