unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39308] [PATCH] gnu: Install the udev rules for light to its output.
@ 2020-01-27 14:52 Amin Bandali
  2020-01-27 17:54 ` Amin Bandali
  0 siblings, 1 reply; 3+ messages in thread
From: Amin Bandali @ 2020-01-27 14:52 UTC (permalink / raw)
  To: 39308; +Cc: Amin Bandali

* gnu/packages/linux.scm (light): Add install-udev-rules phase to copy the
90-backlight.rules file from the root of the repository to the special
lib/udev/rules.d/ directory of the out output.
---
 gnu/packages/linux.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9b0dfd8eb7..dfbe2f88bd 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -5042,6 +5042,15 @@ monitoring tools for Linux.  These include @code{mpstat}, @code{iostat},
         (base32 "0zrjipd392bzjvxx0rjrb0cgi0ix1d83fwgw1mcy8kc4d16cgyjg"))
        (file-name (git-file-name name version))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-udev-rules
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (install-file
+                "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
+               #t))))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)))
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#39308] [PATCH] gnu: Install the udev rules for light to its output.
  2020-01-27 14:52 [bug#39308] [PATCH] gnu: Install the udev rules for light to its output Amin Bandali
@ 2020-01-27 17:54 ` Amin Bandali
  2020-01-27 18:01   ` bug#39308: " Efraim Flashner
  0 siblings, 1 reply; 3+ messages in thread
From: Amin Bandali @ 2020-01-27 17:54 UTC (permalink / raw)
  To: 39308


[-- Attachment #1.1: Type: text/plain, Size: 123 bytes --]


Please find v2 attached below, fixing my oversight of forgetting to
substitute in the correct paths for chgrp and chmod.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Install-udev-rules-for-light-to-allow-sudo-less-.patch --]
[-- Type: text/x-patch, Size: 1815 bytes --]

From 3f9beb0385c03d5c6d34cde76ad7bf2bc2e0c465 Mon Sep 17 00:00:00 2001
From: Amin Bandali <mab@gnu.org>
Date: Mon, 27 Jan 2020 09:33:37 -0500
Subject: [PATCH v2] gnu: Install udev rules for light to allow sudo-less
 invocations.

* gnu/packages/linux.scm (light): Substitute out the absolute paths of chgrp
and chmod in 90-backlight.rules, and install the rules file to the special
lib/udev/rules.d/ directory of the out output.  This allows for any member of
the video group to set brightness using light without using sudo.
---
 gnu/packages/linux.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 9b0dfd8eb7..5162dfff18 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -5042,6 +5042,21 @@ monitoring tools for Linux.  These include @code{mpstat}, @code{iostat},
         (base32 "0zrjipd392bzjvxx0rjrb0cgi0ix1d83fwgw1mcy8kc4d16cgyjg"))
        (file-name (git-file-name name version))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-udev-rules-absolute-path-bins
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "90-backlight.rules"
+               (("/bin/chgrp") (which "chgrp"))
+               (("/bin/chmod") (which "chmod")))
+             #t))
+         (add-after 'install 'install-udev-rules
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (install-file
+                "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
+               #t))))))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)))
-- 
2.25.0


[-- Attachment #1.3: Type: text/plain, Size: 363 bytes --]


The patch works fine for me after adding light to udev-service-type in
my system configuration, as suggested in the manual, like so:

  (simple-service 'light-udev-rules udev-service-type (list light))

-- 
Amin Bandali
Free Software activist | GNU maintainer & webmaster
GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
https://bandali.eu.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#39308: [PATCH] gnu: Install the udev rules for light to its output.
  2020-01-27 17:54 ` Amin Bandali
@ 2020-01-27 18:01   ` Efraim Flashner
  0 siblings, 0 replies; 3+ messages in thread
From: Efraim Flashner @ 2020-01-27 18:01 UTC (permalink / raw)
  To: Amin Bandali; +Cc: 39308-done

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

Looks good to me! Patch pushed.


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-27 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27 14:52 [bug#39308] [PATCH] gnu: Install the udev rules for light to its output Amin Bandali
2020-01-27 17:54 ` Amin Bandali
2020-01-27 18:01   ` bug#39308: " Efraim Flashner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).