machine: Allow non-root users to deploy.
[jackhill/guix/guix.git] / gnu / packages / polkit.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
7 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages polkit)
26 #:use-module ((guix licenses) #:select (lgpl2.0+))
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages freedesktop)
33 #:use-module (gnu packages glib)
34 #:use-module (gnu packages gtk)
35 #:use-module (gnu packages gnuzilla)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages nss)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages qt)
41 #:use-module (gnu packages xml))
42
43 (define-public polkit
44 (package
45 (name "polkit")
46 (version "0.116")
47 (source (origin
48 (method url-fetch)
49 (uri (string-append
50 "https://www.freedesktop.org/software/polkit/releases/"
51 name "-" version ".tar.gz"))
52 (sha256
53 (base32
54 "1c9lbpndh5zis22f154vjrhnqw65z8s85nrgl42v738yf6g0q5w8"))
55 (modules '((guix build utils)))
56 (snippet
57 '(begin
58 (use-modules (guix build utils))
59 ;; Disable broken test.
60 (substitute* "test/Makefile.in"
61 (("SUBDIRS = mocklibc . polkit polkitbackend")
62 "SUBDIRS = mocklibc . polkit"))
63 (substitute* "configure"
64 ;; Replace libsystemd-login with libelogind.
65 (("libsystemd-login") "libelogind")
66 ;; Skip the sanity check that the current system runs
67 ;; systemd.
68 (("test ! -d /sys/fs/cgroup/systemd/") "false"))
69 (substitute* "src/polkit/polkitunixsession-systemd.c"
70 (("systemd") "elogind"))
71 (substitute* "src/polkitbackend/polkitbackendsessionmonitor-systemd.c"
72 (("systemd") "elogind"))
73 (substitute* "src/polkitbackend/polkitbackendjsauthority.cpp"
74 (("systemd") "elogind"))
75
76 ;; Guix System's polkit service stores actions under
77 ;; /etc/polkit-1/actions.
78 (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
79 (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
80 "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
81
82 ;; Set the setuid helper's real location.
83 (substitute* "src/polkitagent/polkitagentsession.c"
84 (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
85 "\"/run/setuid-programs/polkit-agent-helper-1\""))
86 #t))))
87 (build-system gnu-build-system)
88 (inputs
89 `(("expat" ,expat)
90 ("linux-pam" ,linux-pam)
91 ("elogind" ,elogind)
92 ("mozjs" ,mozjs-60)
93 ("nspr" ,nspr)))
94 (propagated-inputs
95 `(("glib" ,glib))) ; required by polkit-gobject-1.pc
96 (native-inputs
97 `(("pkg-config" ,pkg-config)
98 ("glib:bin" ,glib "bin") ; for glib-mkenums
99 ("intltool" ,intltool)
100 ("gobject-introspection" ,gobject-introspection)))
101 (arguments
102 `(#:configure-flags '("--sysconfdir=/etc"
103 ;; XXX: MozJS 60 requires the C++11 ABI or higher.
104 ;; Remove when the default compiler is >= GCC 6.
105 "CXXFLAGS=-std=gnu++11"
106 "--enable-man-pages")
107 #:phases
108 (modify-phases %standard-phases
109 (add-after
110 'unpack 'fix-introspection-install-dir
111 (lambda* (#:key outputs #:allow-other-keys)
112 (let ((out (assoc-ref outputs "out")))
113 (substitute* (find-files "." "Makefile.in")
114 (("@INTROSPECTION_GIRDIR@")
115 (string-append out "/share/gir-1.0/"))
116 (("@INTROSPECTION_TYPELIBDIR@")
117 (string-append out "/lib/girepository-1.0/")))
118 #t)))
119 (replace
120 'install
121 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
122 ;; Override sysconfdir during "make install", to avoid attempting
123 ;; to install in /etc, and to instead install the skeletons in the
124 ;; output directory.
125 (let ((out (assoc-ref outputs "out")))
126 (apply invoke "make" "install"
127 (string-append "sysconfdir=" out "/etc")
128 (string-append "polkit_actiondir="
129 out "/share/polkit-1/actions")
130 make-flags)
131 #t))))))
132 (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
133 (synopsis "Authorization API for privilege management")
134 (description "Polkit is an application-level toolkit for defining and
135 handling the policy that allows unprivileged processes to speak to
136 privileged processes. It is a framework for centralizing the decision
137 making process with respect to granting access to privileged operations
138 for unprivileged applications.")
139 (license lgpl2.0+)))
140
141 (define-public polkit-qt
142 (package
143 (name "polkit-qt")
144 (version "1-0.112.0")
145 (source (origin
146 (method url-fetch)
147 (uri (string-append
148 "http://download.kde.org/stable/apps/KDE4.x/admin/"
149 name "-" version ".tar.bz2"))
150 (sha256
151 (base32
152 "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7"))))
153 (build-system cmake-build-system)
154 (inputs
155 `(("polkit" ,polkit)))
156 (propagated-inputs
157 `(("qtbase" ,qtbase)))
158 (native-inputs
159 `(("pkg-config" ,pkg-config)))
160 (arguments
161 `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_RPATH="
162 (assoc-ref %outputs "out")
163 "/lib:"
164 (assoc-ref %outputs "out")
165 "/lib64"))
166 #:tests? #f)) ; there is a test subdirectory, but no test target
167 (home-page "http://api.kde.org/kdesupport-api/polkit-qt-1-apidocs/")
168 (synopsis "Qt frontend to the polkit library")
169 (description "Polkit-qt is a library that lets developers use the
170 PolicyKit API through a Qt-styled API. It is mainly a wrapper around
171 QAction and QAbstractButton that lets you integrate those two component
172 easily with PolicyKit.")
173 (license lgpl2.0+)))
174
175 (define-public polkit-gnome
176 (package
177 (name "polkit-gnome")
178 (version "0.105")
179 (source (origin
180 (method url-fetch)
181 (uri (string-append "mirror://gnome/sources/"
182 name "/" version "/"
183 name "-" version ".tar.xz"))
184 (sha256
185 (base32
186 "0sckmcbxyj6sbrnfc5p5lnw27ccghsid6v6wxq09mgxqcd4lk10p"))))
187 (build-system gnu-build-system)
188 (inputs `(("gtk+" ,gtk+)
189 ("polkit" ,polkit)))
190 (native-inputs `(("intltool" ,intltool)
191 ("pkg-config" ,pkg-config)))
192 (synopsis "Legacy polkit authentication agent for GNOME")
193 (description "PolicyKit-gnome provides a D-Bus session bus service
194 that is used to bring up authentication dialogs used for obtaining
195 privileges.")
196 (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
197 (license lgpl2.0+)))