unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jorge Acereda <jacereda@gmail.com>
To: 53059@debbugs.gnu.org
Cc: Jorge Acereda <jacereda@gmail.com>
Subject: [bug#53059] [PATCH v3] gnu: Add gpu-switch.
Date: Sat,  8 Jan 2022 20:42:23 +0100	[thread overview]
Message-ID: <2352d01612e4ba02e0021fd8d4bca4215c149b45.1641670916.git.jacereda@gmail.com> (raw)
In-Reply-To: <79655b434893691c6647f28087652f162aad80de.1641496236.git.jacereda@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 3583 bytes --]

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

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 28647477fe..8ec82f1297 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,49 @@ (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")
+      (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





  parent reply	other threads:[~2022-01-08 19:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 19:11 [bug#53059] [PATCH] gnu: Add gpu-switch Jorge Acereda
2022-01-06 21:01 ` Maxime Devos
     [not found]   ` <87pmp42w9k.fsf@gmail.com>
2022-01-07 10:45     ` Maxime Devos
2022-01-07 18:37 ` [bug#53059] [PATCH v2] " Jorge Acereda
2022-01-08 15:38   ` Maxime Devos
2022-01-08 19:42 ` Jorge Acereda [this message]
2022-01-08 19:53 ` [bug#53059] [PATCH v4] " Jorge Acereda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2352d01612e4ba02e0021fd8d4bca4215c149b45.1641670916.git.jacereda@gmail.com \
    --to=jacereda@gmail.com \
    --cc=53059@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).