diff mbox series

[bug#53059] gnu: Add gpu-switch.

Message ID 79655b434893691c6647f28087652f162aad80de.1641496236.git.jacereda@gmail.com
State New
Headers show
Series [bug#53059] gnu: Add gpu-switch. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Jorge Acereda Jan. 6, 2022, 7:11 p.m. UTC
* gnu/packages/graphics.scm (gpu-switch): New variable.
---
 gnu/packages/graphics.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

Comments

M Jan. 6, 2022, 9:01 p.m. UTC | #1
Hi,

Looking at <https://github.com/0xbb/gpu-switch/blob/master/gpu-switch>,
it appears that it uses 'chattr', 'mount', 'grep', 'cat' and
'basename'. So the corresponding packages would need to be added
to 'inputs' and a few 'substitute*' are required such that gpu-switch
doesn't require 'chattr' & friends to be in the environment.

/sys/firmware/efi/efivars is rather Linux-specific, presumably
non-existent on the hurd, so the hurd systems need to be removed from
supported-systems.

> +    (name "gpu-switch")
> +    (version "2017-04-28")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/0xbb/gpu-switch")
> +             (commit "a365f56d435c8ef84c4dd2ab935ede4992359e31")))

Where did you get this version/commit pair from? I'm not seeing it on
<https://github.com/0xbb/gpu-switch/releases>.

Greetings,
Maxime.
M Jan. 7, 2022, 10:45 a.m. UTC | #2
[Re-adding debbugs to CC]

Jorge Acereda schreef op vr 07-01-2022 om 02:02 [+0100]:
> [...]
> > 
> > /sys/firmware/efi/efivars is rather Linux-specific, presumably
> > non-existent on the hurd, so the hurd systems need to be removed from
> > supported-systems.
> 
> Would it be better in linux.scm instead?

While it currently is Linux-specific, in principle it could be ported
to the Hurd, a BSD or Windows or whatever -- in fact, looking at
https://github.com/0xbb/gpu-switch, it appears to support ‘osx’ and
Windows.

linux.scm is more for Linux kernel modules, the Linux kernel, userspace
bindings to kernel syscalls ...

There probably are a few misplaced packages in linux.scm.

Greetings,
Maxime
diff mbox series

Patch

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index fe35aaad2d..b5b50f6192 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -27,6 +27,7 @@ 
 ;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2022 Jorge Acereda <jacereda@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -113,6 +114,7 @@  (define-module (gnu packages graphics)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (guix build-system qt)
+  #:use-module (guix build-system trivial)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix hg-download)
@@ -2011,3 +2013,39 @@  (define-public monado
 such as VR and AR on mobile, PC/desktop, and any other device.  Monado aims to be
 a complete and conforming implementation of the OpenXR API made by Khronos.")
     (license license:boost1.0)))
+
+(define-public gpu-switch
+  (package
+    (name "gpu-switch")
+    (version "2017-04-28")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/0xbb/gpu-switch")
+             (commit "a365f56d435c8ef84c4dd2ab935ede4992359e31")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1jnh43nijkqd83h7piq7225ixziggyzaalabgissyxdyz6szcn0r"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((out (assoc-ref %outputs "out"))
+               (gpu-switch (search-input-file %build-inputs "gpu-switch"))
+               (readme (search-input-file %build-inputs "README.md")))
+           (install-file gpu-switch (string-append out "/bin"))
+           (install-file readme (string-append out "/share/doc/gpu-switch-" ,version))
+           #t))))
+    (home-page "https://github.com/0xbb/gpu-switch")
+    (synopsis "GPU switcher for dual-GPU MacBook Pro models")
+    (description
+     "Switch between the integrated and dedicated GPU of dual-GPU MacBook Pro
+models for the next reboot.
+
+It aims to remove the need of booting into OS X and running gfxCardStatus
+v2.2.1 to switch to the integrated card.")
+    (license license:expat)))
+