From patchwork Sat Jan 8 19:42:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jorge Acereda X-Patchwork-Id: 36167 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E2EC627BBEA; Sat, 8 Jan 2022 19:44:27 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E752C27BBE9 for ; Sat, 8 Jan 2022 19:44:26 +0000 (GMT) Received: from localhost ([::1]:48128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6Hda-0002pl-36 for patchwork@mira.cbaines.net; Sat, 08 Jan 2022 14:44:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6HdC-0002pE-Ps for guix-patches@gnu.org; Sat, 08 Jan 2022 14:44:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n6HdC-0000Hl-Ha for guix-patches@gnu.org; Sat, 08 Jan 2022 14:44:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n6HdC-0003eL-8P for guix-patches@gnu.org; Sat, 08 Jan 2022 14:44:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53059] [PATCH v3] gnu: Add gpu-switch. References: <79655b434893691c6647f28087652f162aad80de.1641496236.git.jacereda@gmail.com> In-Reply-To: <79655b434893691c6647f28087652f162aad80de.1641496236.git.jacereda@gmail.com> Resent-From: Jorge Acereda Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 08 Jan 2022 19:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53059 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53059@debbugs.gnu.org Cc: Jorge Acereda Received: via spool by 53059-submit@debbugs.gnu.org id=B53059.164167098713947 (code B ref 53059); Sat, 08 Jan 2022 19:44:02 +0000 Received: (at 53059) by debbugs.gnu.org; 8 Jan 2022 19:43:07 +0000 Received: from localhost ([127.0.0.1]:48747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6HcI-0003cr-Rq for submit@debbugs.gnu.org; Sat, 08 Jan 2022 14:43:07 -0500 Received: from mail-wm1-f50.google.com ([209.85.128.50]:53211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6HcG-0003cM-JE for 53059@debbugs.gnu.org; Sat, 08 Jan 2022 14:43:05 -0500 Received: by mail-wm1-f50.google.com with SMTP id v123so6183178wme.2 for <53059@debbugs.gnu.org>; Sat, 08 Jan 2022 11:43:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jGOw0ZC0utE7DaUqQzioLA2kfXK1FfCx1weZe1dhXKY=; b=e6e6n3teRVY/+MWDVLAlBotlSwrdG8nH5D42Fy7plFhuQcieuJMcp9qFRsn2SYZjCV dMQ3/3C4bkDI1qalxfZmmCoVDRe6zj/YQi/ztGJQR5YdPVYUa0HvTP691E04Ws4nfxXf Hub55x+vW88xi+r8mUXuV8y0kidUQuWAb+/8GKPEvg1i4LrmaaWWc0oWoDP4yZCUlMjs KgbfSh1PmhRID3TW0/DgqI7reC7RFSBpHTvWanUXYqeOsboUcAu9ezfd4qcjhs5q60Eg KRfw4AhrxeLMzHMiZCrNzobqNy3rFLjoc5NHFL557/fumCNf7HlPctpBZQ2Rj2+JNwLv LvMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jGOw0ZC0utE7DaUqQzioLA2kfXK1FfCx1weZe1dhXKY=; b=7jmIayz2URNZMEfMDEYLyw9TOD0ieHZmGW9UB3tyoSPHyQtk695xpe3Vg7WQo5xEiY XIoV24GbE5o5RLWudGj+W3GNxYHSs0eOEwtdkRVB4Ir6j3rFb6lfZYXcUtlEmdSo9McH S91pByPqiCc4DLVM8dzZgff1X/BPPb9vkyNGL7YzsV6yl2aKZt2xGvqdQuBugOAr0QZA PYhIIEkzvI8XFtT4N9CSFNtDiGr4SDGofkL68FBpU/w01PYrbc1JXjHPZpwxhMKz52Ay tzrzoNgEix9pvWZ96MCj0P4RKrr6oruHC4W+KsVr9OcAT4WNxwTV1Sr2ruDWWXknlWkJ gPUA== X-Gm-Message-State: AOAM5335KsLsq0f5Y7mvWorCY/mqj0kGPP+UVeiS3U8DlSqH0F6jQ151 JAbLwHZVm7GBwPUB1OPxBL9bj0ys9IXycA== X-Google-Smtp-Source: ABdhPJwUaBcRf6EQLO952zxI6RoAc9y7GsFEyprpvPvTM6YuNw5sZKUov6ctx1B0qt1kMFSkqe+G+A== X-Received: by 2002:a05:600c:3b28:: with SMTP id m40mr6171388wms.192.1641670978777; Sat, 08 Jan 2022 11:42:58 -0800 (PST) Received: from mbp.lan ([185.39.42.151]) by smtp.gmail.com with ESMTPSA id m10sm2268367wms.25.2022.01.08.11.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 11:42:58 -0800 (PST) From: Jorge Acereda Date: Sat, 8 Jan 2022 20:42:23 +0100 Message-Id: <2352d01612e4ba02e0021fd8d4bca4215c149b45.1641670916.git.jacereda@gmail.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2021 Vinicius Monego ;;; Copyright © 2021 John Kehayias +;;; Copyright © 2022 Jorge Acereda ;;; ;;; 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))))