projects/guix·blob javascript-team · refs

256 lines · 10.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Andreas Enge <[email protected]>
3;;; Copyright © 2015 Andy Wingo <[email protected]>
4;;; Copyright © 2015, 2021-2022 Ludovic Courtès <[email protected]>
5;;; Copyright © 2015 Mark H Weaver <[email protected]>
6;;; Copyright © 2016, 2022 Efraim Flashner <[email protected]>
7;;; Copyright © 2017 Huang Ying <[email protected]>
8;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
9;;; Copyright © 2018 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2021 Morgan Smith <[email protected]>
11;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <[email protected]>
12;;; Copyright © 2022 Marius Bakke <[email protected]>
13;;; Copyright © 2021, 2022 Maxim Cournoyer <[email protected]>
14;;; Copyright © 2025 Josep Bigorra <[email protected]>
15;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages polkit)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix gexp)
36 #:use-module (guix memoization)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix utils)
40 #:use-module (guix build utils)
41 #:use-module (guix build-system cmake)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system meson)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages cpp)
46 #:use-module (gnu packages gettext)
47 #:use-module (gnu packages freedesktop)
48 #:use-module (gnu packages gcc)
49 #:use-module (gnu packages glib)
50 #:use-module (gnu packages gtk)
51 #:use-module (gnu packages docbook)
52 #:use-module (gnu packages javascript)
53 #:use-module (gnu packages linux)
54 #:use-module (gnu packages nss)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-xyz)
59 #:use-module (gnu packages qt)
60 #:use-module (gnu packages xdisorg)
61 #:use-module (gnu packages xml))
62
63(define-public hyprpolkitagent
64 (package
65 (name "hyprpolkitagent")
66 (version "0.1.3")
67 (source
68 (origin
69 (method git-fetch)
70 (uri (git-reference
71 (url "https://github.com/hyprwm/hyprpolkitagent")
72 (commit (string-append "v" version))))
73 (file-name (git-file-name name version))
74 (sha256
75 (base32 "021r0gjy2xip0jwsv0k823k156gsa7s3rylwai53ymxd53m51p6z"))))
76 (build-system cmake-build-system)
77 (arguments
78 (list
79 #:tests? #f)) ;; No tests yet.
80 (native-inputs
81 (list gcc-15
82 pkg-config))
83 (inputs
84 (list hyprutils
85 hyprland-qtutils
86 polkit
87 polkit-qt6
88 qtwayland
89 qtbase
90 qtdeclarative
91 libxkbcommon))
92 (home-page "https://wiki.hypr.land/Hypr-Ecosystem/hyprpolkitagent/")
93 (synopsis "Simple polkit authentication agent for Hyprland")
94 (description
95 "hyprpolkitagent is a polkit authentication daemon written in QT/QML.
96It is required for @acronym{GUI, Graphical User Interface} applications to be
97able to request elevated privileges.")
98 (license license:bsd-3)))
99
100(define-public polkit
101 (package
102 (name "polkit")
103 (version "121")
104 (source (origin
105 (method url-fetch)
106 (uri (string-append
107 "https://www.freedesktop.org/software/polkit/releases/"
108 name "-" version ".tar.gz"))
109 (patches (search-patches "polkit-disable-systemd.patch"))
110 (sha256
111 (base32
112 "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx"))
113 (modules '((guix build utils)))
114 (snippet
115 '(begin
116 ;; This is so that the default example rules files can be
117 ;; installed along the package; otherwise it would fail
118 ;; attempting to write to /etc. Unlike with GNU Autotools,
119 ;; Meson can't override the pkgsysconfdir value at install
120 ;; time; instead, we rewrite the pkgsysconfdir references
121 ;; in the build system to point to #$output/etc.
122 ;; Look up actions and rules from /etc/polkit ...
123 (substitute* "src/polkitbackend/meson.build"
124 (("'-DPACKAGE_SYSCONF_DIR=.*,")
125 "'-DPACKAGE_SYSCONF_DIR=\"/etc\"',"))
126 (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
127 (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
128 "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
129 ;; ... but install package files below the prefix.
130 (substitute* "meson.build"
131 (("pk_sysconfdir = get_option\\('sysconfdir'\\)")
132 "pk_sysconfdir = get_option('prefix') + '/etc'"))
133 ;; Set the setuid helper's real location.
134 (substitute* "src/polkitagent/polkitagentsession.c"
135 (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
136 "\"/run/setuid-programs/polkit-agent-helper-1\""))))))
137 (build-system meson-build-system)
138 (arguments
139 (list
140 #:modules '((guix build meson-build-system)
141 (guix build utils)
142 (ice-9 match))
143 #:configure-flags
144 #~(list "--sysconfdir=/etc"
145 "-Dsession_tracking=libelogind"
146 "-Dman=true"
147 "-Dtests=true"
148 ;; Work around cross-compilation failure. The build system
149 ;; probes for the _target_ gobject-introspection, but if we
150 ;; change it to native, Meson fails with:
151 ;; ERROR: Pkg-config binary for machine
152 ;; MachineChoice.BUILD not found, giving up.
153 ;; Just disable introspection for now.
154 #$@(if (%current-target-system)
155 '("-Dintrospection=false")
156 '()))
157 #:phases
158 #~(modify-phases %standard-phases
159 (add-before 'configure 'relax-gcc-14-strictness
160 (lambda _
161 (setenv "CFLAGS"
162 "-g -O2 -Wno-error=implicit-function-declaration")))
163 (add-before 'check 'patch-bash
164 (lambda _
165 (substitute* (list "subprojects/mocklibc-1.0/bin/mocklibc"
166 (string-append "../polkit-v." #$version
167 "/test/data/etc/passwd")
168 (string-append "../polkit-v." #$version
169 "/test/data/etc/polkit-1"
170 "/rules.d/10-testing.rules"))
171 (("/bin/(bash|false|true)" _ command)
172 (which command))))))))
173 (inputs
174 (list duktape expat elogind linux-pam nspr))
175 (propagated-inputs
176 (list glib)) ;required by polkit-gobject-1.pc
177 (native-inputs
178 (list gettext-minimal
179 `(,glib "bin") ;for glib-mkenums
180 docbook-xsl ;for man page generation
181 gobject-introspection
182 libxslt ;for man page generation
183 perl
184 pkg-config
185 python
186 python-dbusmock-for-tests))
187 (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
188 (synopsis "Authorization API for privilege management")
189 (description "Polkit is an application-level toolkit for defining and
190handling the policy that allows unprivileged processes to speak to
191privileged processes. It is a framework for centralizing the decision
192making process with respect to granting access to privileged operations
193for unprivileged applications.")
194 (license license:lgpl2.0+)))
195
196(define-public polkit-qt
197 (package
198 (name "polkit-qt")
199 (version "0.200.0")
200 (source (origin
201 (method url-fetch)
202 (uri (string-append
203 "mirror://kde/stable/polkit-qt-1/"
204 name "-1-" version ".tar.xz"))
205 (sha256
206 (base32
207 "1yvp2s72fgpn5kf1a2ldy0givlmz0z4i1fsh6ylpcard0qf62fsx"))))
208 (build-system cmake-build-system)
209 (inputs
210 (list qtbase-5 polkit))
211 (native-inputs
212 (list pkg-config))
213 (arguments
214 (list #:configure-flags
215 #~(list (string-append
216 "-DQT_MAJOR_VERSION="
217 #$(version-major
218 (package-version (this-package-input "qtbase")))))
219 #:tests? #f)) ; there is a test subdirectory, but no test target
220 (home-page "https://api.kde.org/kdesupport-api/polkit-qt-1-apidocs/")
221 (properties `((upstream-name . "polkit-qt-1")))
222 (synopsis "Qt frontend to the polkit library")
223 (description "Polkit-qt is a library that lets developers use the
224PolicyKit API through a Qt-styled API. It is mainly a wrapper around
225QAction and QAbstractButton that lets you integrate those two component
226easily with PolicyKit.")
227 (license license:lgpl2.0+)))
228
229(define-public polkit-qt6
230 (package
231 (inherit polkit-qt)
232 (name "polkit-qt6")
233 (inputs (modify-inputs inputs
234 (replace "qtbase" qtbase)))))
235
236(define-public polkit-gnome
237 (package
238 (name "polkit-gnome")
239 (version "0.105")
240 (source (origin
241 (method url-fetch)
242 (uri (string-append "mirror://gnome/sources/"
243 name "/" version "/"
244 name "-" version ".tar.xz"))
245 (sha256
246 (base32
247 "0sckmcbxyj6sbrnfc5p5lnw27ccghsid6v6wxq09mgxqcd4lk10p"))))
248 (build-system gnu-build-system)
249 (inputs (list gtk+ polkit))
250 (native-inputs (list intltool pkg-config))
251 (synopsis "Legacy polkit authentication agent for GNOME")
252 (description "PolicyKit-gnome provides a D-Bus session bus service
253that is used to bring up authentication dialogs used for obtaining
254privileges.")
255 (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
256 (license license:lgpl2.0+)))