From patchwork Sat Jan 8 19:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jorge Acereda X-Patchwork-Id: 36168 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 6F09C27BBEA; Sat, 8 Jan 2022 19:54:10 +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 EB9BB27BBE9 for ; Sat, 8 Jan 2022 19:54:09 +0000 (GMT) Received: from localhost ([::1]:48732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6Hmz-00044c-3k for patchwork@mira.cbaines.net; Sat, 08 Jan 2022 14:54:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6Hms-00044A-ED for guix-patches@gnu.org; Sat, 08 Jan 2022 14:54:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n6Hms-0001aa-5y for guix-patches@gnu.org; Sat, 08 Jan 2022 14:54:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n6Hms-0003xS-3H for guix-patches@gnu.org; Sat, 08 Jan 2022 14:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53059] [PATCH v4] 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:54: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.164167164015206 (code B ref 53059); Sat, 08 Jan 2022 19:54:02 +0000 Received: (at 53059) by debbugs.gnu.org; 8 Jan 2022 19:54:00 +0000 Received: from localhost ([127.0.0.1]:48755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6Hmq-0003xC-Dp for submit@debbugs.gnu.org; Sat, 08 Jan 2022 14:54:00 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:42594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6Hmm-0003wt-MX for 53059@debbugs.gnu.org; Sat, 08 Jan 2022 14:53:59 -0500 Received: by mail-wr1-f53.google.com with SMTP id k30so688619wrd.9 for <53059@debbugs.gnu.org>; Sat, 08 Jan 2022 11:53:56 -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=/i2JarDuxaYe9jiXCGGs0zNyvMIiUMHed8C+1arbvz4=; b=YgpD6QsCtqbyUHlNbHS9/K564rWMBWYsycISPmtsYfC091Br2eNa09QLxDfhRvs+ny dOo+0fw82LOWCdM5ukOWW63Kyub+cUGGHTmchjCIzdzZZ+BedbrYwWe5dPzgUcVEQ7dY a/OnWi+UhoSKmyymrGlZlnsT3SdAhJ9pNXPC9BIEdtsyMzQa9daE2BYQUKHoF1jqdhXu Pe1sAnkKRIB10is6jDKe/p9qYE9CIu1XIM5dWj3pAdQQ6eYlJuh4AszCvLM6J3TZFk8h a758I56uBaoodQQYHhDv966XRtnLLrytd+2DEFOJtUYPM2Q9caZvSJrP5hEvh4zcJJ6F zaZg== 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=/i2JarDuxaYe9jiXCGGs0zNyvMIiUMHed8C+1arbvz4=; b=3KoPN4OBD6zLRsu+MCyGwOdEhAjPuppg99JK+bUkXfeBgqBlYqeJFvUgBKTxhbNTRz p4sbK/kSoidYumNVUsRw9BO072IGIpBgQRn7N4Bg6DQfCct9vkQE1sTb0laMnad2inxc 0WSDIwp2AijbdYmVA2JVbtygNG0Gk1GJPGMv1AhduQNtTYtByvZTw04moVWBzuFjiA2R k/w9mhATcTLt54p49xA/YMBgCjxu8Vd3V/d6aoVx+/FWzmsJOSGwpcI0fDwylvebMOYM B0b7Ek70hRyBeJgL+W12W5SfErTu3pSBZU1uftSmUX8lTLvuTLVmYadenzAqecziQiym 1vyQ== X-Gm-Message-State: AOAM530U0evPxTlFa7IX1/ZzC83RsSRzA37mqPGkUhe/ca2N6TSaCfLE Qtq7W6ddYbiyDKVqRKJJQADzZ3tOvnchmg== X-Google-Smtp-Source: ABdhPJwleoRNxQtX2MBXJq/Tt5aVpSh+4sxiUwCJHiFHqf0sOeMm394k3IBTvKpeAqL/pP4h0vuXUg== X-Received: by 2002:a05:6000:15cd:: with SMTP id y13mr59802033wry.28.1641671630866; Sat, 08 Jan 2022 11:53:50 -0800 (PST) Received: from mbp.lan ([185.39.42.151]) by smtp.gmail.com with ESMTPSA id n41sm2526707wms.32.2022.01.08.11.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 11:53:50 -0800 (PST) From: Jorge Acereda Date: Sat, 8 Jan 2022 20:53:04 +0100 Message-Id: <4cd31369f81c4d3ced341bbe9d0e3aaba95cdf47.1641671488.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 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 ;;; 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,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))))