1{
2 stdenv,
3 fetchFromGitHub,
4 lib,
5 gettext,
6 glib,
7 pkg-config,
8 polkit,
9 python3,
10 sqlite,
11 gobject-introspection,
12 vala,
13 gtk-doc,
14 boost,
15 meson,
16 ninja,
17 libxslt,
18 docbook-xsl-nons,
19 docbook_xml_dtd_42,
20 libxml2,
21 gst_all_1,
22 gtk3,
23 enableCommandNotFound ? false,
24 enableBashCompletion ? false,
25 bash-completion ? null,
26 enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
27 systemd,
28 nixosTests,
29}:
30
31stdenv.mkDerivation rec {
32 pname = "packagekit";
33 version = "1.3.1";
34
35 outputs = [
36 "out"
37 "dev"
38 "devdoc"
39 ];
40
41 src = fetchFromGitHub {
42 owner = "PackageKit";
43 repo = "PackageKit";
44 rev = "v${version}";
45 hash = "sha256-8sgvD6pZ2n4Du44kTPsvYtSYpkMKCpfxeSrGjWeSw50=";
46 };
47
48 buildInputs = [
49 glib
50 polkit
51 python3
52 gst_all_1.gstreamer
53 gst_all_1.gst-plugins-base
54 gtk3
55 sqlite
56 boost
57 ]
58 ++ lib.optional enableSystemd systemd
59 ++ lib.optional enableBashCompletion bash-completion;
60 nativeBuildInputs = [
61 gobject-introspection
62 glib
63 vala
64 gettext
65 pkg-config
66 gtk-doc
67 meson
68 libxslt
69 docbook-xsl-nons
70 docbook_xml_dtd_42
71 libxml2
72 ninja
73 ];
74
75 mesonFlags = [
76 (if enableSystemd then "-Dsystemd=true" else "-Dsystem=false")
77 # often fails to build with nix updates
78 # and remounts /nix/store as rw
79 # https://github.com/NixOS/nixpkgs/issues/177946
80 #"-Dpackaging_backend=nix"
81 "-Ddbus_sys=${placeholder "out"}/share/dbus-1/system.d"
82 "-Ddbus_services=${placeholder "out"}/share/dbus-1/system-services"
83 "-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
84 "-Dcron=false"
85 "-Dgtk_doc=true"
86 "--sysconfdir=/etc"
87 "--localstatedir=/var"
88 ]
89 ++ lib.optional (!enableBashCompletion) "-Dbash_completion=false"
90 ++ lib.optional (!enableCommandNotFound) "-Dbash_command_not_found=false";
91
92 postPatch = ''
93 # HACK: we want packagekit to look in /etc for configs but install
94 # those files in $out/etc ; we just override the runtime paths here
95 # same for /var & $out/var
96 substituteInPlace etc/meson.build \
97 --replace "install_dir: join_paths(get_option('sysconfdir'), 'PackageKit')" "install_dir: join_paths('$out', 'etc', 'PackageKit')"
98 substituteInPlace data/meson.build \
99 --replace "install_dir: join_paths(get_option('localstatedir'), 'lib', 'PackageKit')," "install_dir: join_paths('$out', 'var', 'lib', 'PackageKit'),"
100 '';
101
102 passthru.tests = {
103 nixos-test = nixosTests.packagekit;
104 };
105
106 meta = with lib; {
107 description = "System to facilitate installing and updating packages";
108 longDescription = ''
109 PackageKit is a system designed to make installing and updating software
110 on your computer easier. The primary design goal is to unify all the
111 software graphical tools used in different distributions, and use some of
112 the latest technology like PolicyKit. The actual nuts-and-bolts distro
113 tool (dnf, apt, etc) is used by PackageKit using compiled and scripted
114 helpers. PackageKit isn't meant to replace these tools, instead providing
115 a common set of abstractions that can be used by standard GUI and text
116 mode package managers.
117 '';
118 homepage = "https://github.com/PackageKit/PackageKit";
119 license = licenses.gpl2Plus;
120 platforms = platforms.unix;
121 maintainers = with maintainers; [ matthewbauer ];
122 };
123}