guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jorge Acereda
Subject: [bug#53059] [PATCH v4] gnu: Add gpu-switch.
Date: Sat, 8 Jan 2022 20:53:04 +0100

Forgot to specify supported-systems.

* gnu/packages/graphics.scm (gpu-switch): New variable.
---
 gnu/packages/hardware.scm | 51 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 28647477fe..a8ec6567cd 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -9,6 +9,7 @@
 ;;; Copyright ?? 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright ?? 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright ?? 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright ?? 2022 Jorge Acereda <jacereda@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +30,7 @@ (define-module (gnu packages hardware)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages check)
@@ -64,7 +66,9 @@ (define-module (gnu packages hardware)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -844,3 +848,50 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public gpu-switch
+  ;; No tagged commit.  No "Version" keyword either.
+  (let ((commit "a365f56d435c8ef84c4dd2ab935ede4992359e31")
+        (revision "1"))
+    (package
+      (name "gpu-switch")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/0xbb/gpu-switch";)
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1jnh43nijkqd83h7piq7225ixziggyzaalabgissyxdyz6szcn0r"))))
+      (build-system trivial-build-system)
+      (arguments
+       (list
+        #:modules '((guix build utils))
+        #:builder
+        #~(begin
+            (use-modules (guix build utils))
+            (install-file #$(file-append source "/gpu-switch")
+                          (string-append #$output "/bin"))
+            (substitute* (string-append #$output "/bin/gpu-switch")
+              (("basename") #$(file-append coreutils-minimal "/bin/basename"))
+              (("cat ") #$(file-append coreutils-minimal "/bin/cat "))
+              (("chattr") #$(file-append e2fsprogs "/bin/chattr"))
+              (("/usr/bin/env bash") #$(file-append bash-minimal "/bin/bash"))
+              (("grep") #$(file-append grep "/bin/grep"))
+              (("! mount")
+               (string-append "! " #$(file-append util-linux "/bin/mount"))))
+            (install-file
+             #$(file-append source "/README.md")
+             (string-append #$output "/share/doc/gpu-switch-" #$version)))))
+      (home-page "https://github.com/0xbb/gpu-switch";)
+      (supported-systems '("x86_64-linux"))      
+      (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))))
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]