polkit.scm 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. (define-module (gnu packages polkit)
  25. #:use-module ((guix licenses) #:select (lgpl2.0+))
  26. #:use-module (guix packages)
  27. #:use-module (guix download)
  28. #:use-module (guix build-system cmake)
  29. #:use-module (guix build-system gnu)
  30. #:use-module (gnu packages)
  31. #:use-module (gnu packages freedesktop)
  32. #:use-module (gnu packages glib)
  33. #:use-module (gnu packages gtk)
  34. #:use-module (gnu packages gnuzilla)
  35. #:use-module (gnu packages linux)
  36. #:use-module (gnu packages nss)
  37. #:use-module (gnu packages perl)
  38. #:use-module (gnu packages pkg-config)
  39. #:use-module (gnu packages qt)
  40. #:use-module (gnu packages xml))
  41. (define-public polkit
  42. (package
  43. (name "polkit")
  44. (version "0.116")
  45. (replacement polkit/fixed)
  46. (source (origin
  47. (method url-fetch)
  48. (uri (string-append
  49. "https://www.freedesktop.org/software/polkit/releases/"
  50. name "-" version ".tar.gz"))
  51. (sha256
  52. (base32
  53. "1c9lbpndh5zis22f154vjrhnqw65z8s85nrgl42v738yf6g0q5w8"))
  54. (modules '((guix build utils)))
  55. (snippet
  56. '(begin
  57. (use-modules (guix build utils))
  58. ;; Disable broken test.
  59. (substitute* "test/Makefile.in"
  60. (("SUBDIRS = mocklibc . polkit polkitbackend")
  61. "SUBDIRS = mocklibc . polkit"))
  62. (substitute* "configure"
  63. ;; Replace libsystemd-login with libelogind.
  64. (("libsystemd-login") "libelogind")
  65. ;; Skip the sanity check that the current system runs
  66. ;; systemd.
  67. (("test ! -d /sys/fs/cgroup/systemd/") "false"))
  68. (substitute* "src/polkit/polkitunixsession-systemd.c"
  69. (("systemd") "elogind"))
  70. (substitute* "src/polkitbackend/polkitbackendsessionmonitor-systemd.c"
  71. (("systemd") "elogind"))
  72. (substitute* "src/polkitbackend/polkitbackendjsauthority.cpp"
  73. (("systemd") "elogind"))
  74. ;; Guix System's polkit service stores actions under
  75. ;; /etc/polkit-1/actions.
  76. (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
  77. (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
  78. "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
  79. ;; Set the setuid helper's real location.
  80. (substitute* "src/polkitagent/polkitagentsession.c"
  81. (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
  82. "\"/run/setuid-programs/polkit-agent-helper-1\""))
  83. #t))))
  84. (build-system gnu-build-system)
  85. (inputs
  86. `(("expat" ,expat)
  87. ("linux-pam" ,linux-pam)
  88. ("elogind" ,elogind)
  89. ("mozjs" ,mozjs-60)
  90. ("nspr" ,nspr)))
  91. (propagated-inputs
  92. `(("glib" ,glib))) ; required by polkit-gobject-1.pc
  93. (native-inputs
  94. `(("pkg-config" ,pkg-config)
  95. ("glib:bin" ,glib "bin") ; for glib-mkenums
  96. ("intltool" ,intltool)
  97. ("gobject-introspection" ,gobject-introspection)))
  98. (arguments
  99. `(#:configure-flags '("--sysconfdir=/etc"
  100. "--enable-man-pages"
  101. ;; Prevent ‘configure: error: cannot check for
  102. ;; file existence when cross compiling’.
  103. ,@(if (%current-target-system)
  104. '("--with-os-type=unknown")
  105. '()))
  106. #:phases
  107. (modify-phases %standard-phases
  108. (add-after
  109. 'unpack 'fix-introspection-install-dir
  110. (lambda* (#:key outputs #:allow-other-keys)
  111. (let ((out (assoc-ref outputs "out")))
  112. (substitute* (find-files "." "Makefile.in")
  113. (("@INTROSPECTION_GIRDIR@")
  114. (string-append out "/share/gir-1.0/"))
  115. (("@INTROSPECTION_TYPELIBDIR@")
  116. (string-append out "/lib/girepository-1.0/")))
  117. #t)))
  118. (replace
  119. 'install
  120. (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
  121. ;; Override sysconfdir during "make install", to avoid attempting
  122. ;; to install in /etc, and to instead install the skeletons in the
  123. ;; output directory.
  124. (let ((out (assoc-ref outputs "out")))
  125. (apply invoke "make" "install"
  126. (string-append "sysconfdir=" out "/etc")
  127. (string-append "polkit_actiondir="
  128. out "/share/polkit-1/actions")
  129. make-flags)
  130. #t))))))
  131. (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
  132. (synopsis "Authorization API for privilege management")
  133. (description "Polkit is an application-level toolkit for defining and
  134. handling the policy that allows unprivileged processes to speak to
  135. privileged processes. It is a framework for centralizing the decision
  136. making process with respect to granting access to privileged operations
  137. for unprivileged applications.")
  138. (license lgpl2.0+)))
  139. (define polkit/fixed
  140. (package
  141. (inherit polkit)
  142. (source (origin
  143. (inherit (package-source polkit))
  144. (patches (search-patches "polkit-CVE-2021-3560.patch"))))))
  145. (define-public polkit-qt
  146. (package
  147. (name "polkit-qt")
  148. (version "1-0.112.0")
  149. (source (origin
  150. (method url-fetch)
  151. (uri (string-append
  152. "mirror://kde//stable/apps/KDE4.x/admin/"
  153. "polkit-qt-" version ".tar.bz2"))
  154. (sha256
  155. (base32
  156. "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7"))))
  157. (build-system cmake-build-system)
  158. (inputs
  159. `(("polkit" ,polkit)))
  160. (propagated-inputs
  161. `(("qtbase" ,qtbase-5)))
  162. (native-inputs
  163. `(("pkg-config" ,pkg-config)))
  164. (arguments
  165. `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_RPATH="
  166. (assoc-ref %outputs "out")
  167. "/lib:"
  168. (assoc-ref %outputs "out")
  169. "/lib64"))
  170. #:tests? #f)) ; there is a test subdirectory, but no test target
  171. (home-page "https://api.kde.org/kdesupport-api/polkit-qt-1-apidocs/")
  172. (synopsis "Qt frontend to the polkit library")
  173. (description "Polkit-qt is a library that lets developers use the
  174. PolicyKit API through a Qt-styled API. It is mainly a wrapper around
  175. QAction and QAbstractButton that lets you integrate those two component
  176. easily with PolicyKit.")
  177. (license lgpl2.0+)))
  178. (define-public polkit-gnome
  179. (package
  180. (name "polkit-gnome")
  181. (version "0.105")
  182. (source (origin
  183. (method url-fetch)
  184. (uri (string-append "mirror://gnome/sources/"
  185. name "/" version "/"
  186. name "-" version ".tar.xz"))
  187. (sha256
  188. (base32
  189. "0sckmcbxyj6sbrnfc5p5lnw27ccghsid6v6wxq09mgxqcd4lk10p"))))
  190. (build-system gnu-build-system)
  191. (inputs `(("gtk+" ,gtk+)
  192. ("polkit" ,polkit)))
  193. (native-inputs `(("intltool" ,intltool)
  194. ("pkg-config" ,pkg-config)))
  195. (synopsis "Legacy polkit authentication agent for GNOME")
  196. (description "PolicyKit-gnome provides a D-Bus session bus service
  197. that is used to bring up authentication dialogs used for obtaining
  198. privileges.")
  199. (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
  200. (license lgpl2.0+)))