From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id hPtmL53p2WHzgwAAgWs5BA (envelope-from ) for ; Sat, 08 Jan 2022 20:44:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UBflK53p2WEhhgAA9RJhRA (envelope-from ) for ; Sat, 08 Jan 2022 20:44:29 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2957E1C5EF for ; Sat, 8 Jan 2022 20:44:29 +0100 (CET) Received: from localhost ([::1]:48128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6Hdc-0002pl-B2 for larch@yhetil.org; Sat, 08 Jan 2022 14:44:28 -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 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641671069; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jGOw0ZC0utE7DaUqQzioLA2kfXK1FfCx1weZe1dhXKY=; b=peDFFJWHNWdDWHzL7qv37CmwtUwSnQqzdzqNVawPGAnloxY2ZKJKD1vTIwh50udSGOZV0S dE/nyZBclDm/pk5iYuv9couQrXd6p44LN8UPk+JL8kK1/0xdlkalojgR+xqjE6kLBt/8zL 0hB+94vAF0lx3XphzrCvIQA7kneeFaKZMdxhuWAd4t4ldkZFaK7XGIJ2unhR9g4hdTg1Qz SQVj7LWSJNDB7CN1n+Ib66yNgYN/XrXBMkq6VRnhg/ozLIXg5XQeAT4Ayw8koMZZp8J+HK mbtQUf4R3Uec594g5U/IbUOrw2XyGC1XHKDLP2Y0uILQFZCOAZWqAte5aoZNjA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641671069; a=rsa-sha256; cv=none; b=AdxxwjdFYR4BNYpY7i+sQoAbJ806JCh7z+DC4eMpD996a5LiLX5PpskvHyEGgFEg/vM/QZ JGrsyNwJE5CvMY0F8ZoeOUTxw4/SSEMahvtJoPfyOOBsS+/rChL55dlUaoNktSBICWPEog bmqztmR7ZIDiF1+ayVpomXIwxnVk9QrU3ZPCh1nvAvVPsl9OU7OvRFzfz/GlABxh3oCXC2 Xi33+nQaxlZ/TyAteGt4qHZAEDTXmclzCjHVRBV1U+wHsFgkp1kFSebG1oedIgPfdYU4mX GVGxvjGWtvWQ8x/ILNdL//jbtqGbjadnvIdFTQa3Y7u1mEwMkCU0YgXXBpOcVw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=e6e6n3te; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.50 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=e6e6n3te; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 2957E1C5EF X-Spam-Score: -1.50 X-Migadu-Scanner: scn0.migadu.com X-TUID: ovStavvXYLwc * 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)))) -- 2.34.0