From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 YOOqER2K2GG3wAAAgWs5BA (envelope-from ) for ; Fri, 07 Jan 2022 19:44:45 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id +C9VCh2K2GHAbQEAG6o9tA (envelope-from ) for ; Fri, 07 Jan 2022 19:44:45 +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 1ADC227286 for ; Fri, 7 Jan 2022 19:44:44 +0100 (CET) Received: from localhost ([::1]:58366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5uEF-0004uk-2W for larch@yhetil.org; Fri, 07 Jan 2022 13:44:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5uDb-0004tk-M7 for guix-patches@gnu.org; Fri, 07 Jan 2022 13:44:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:52987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5uDb-0004jO-92 for guix-patches@gnu.org; Fri, 07 Jan 2022 13:44:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5uDa-0006GJ-FV for guix-patches@gnu.org; Fri, 07 Jan 2022 13:44:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53059] [PATCH v2] 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: Fri, 07 Jan 2022 18: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.164158103624046 (code B ref 53059); Fri, 07 Jan 2022 18:44:02 +0000 Received: (at 53059) by debbugs.gnu.org; 7 Jan 2022 18:43:56 +0000 Received: from localhost ([127.0.0.1]:45890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5uDQ-0006Fg-OU for submit@debbugs.gnu.org; Fri, 07 Jan 2022 13:43:56 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:35651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5uDJ-0006FI-GU for 53059@debbugs.gnu.org; Fri, 07 Jan 2022 13:43:51 -0500 Received: by mail-wr1-f48.google.com with SMTP id e9so11230077wra.2 for <53059@debbugs.gnu.org>; Fri, 07 Jan 2022 10:43:45 -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=0jOmp8sm+I0njEp1KAjAqRcU4CBb9i/a5zPESWjyQ0I=; b=FcAQhKLPl2tC1zf0Xnaphd5vezVxCBRNAqCdokwrqjzJP3QD+j+vae/Ll3ymqBZvk/ Zc4KsGzAQCmuCiO4wd4tUkyaOiWRiDN2yyUW6Iorv9kaqo7Xbqk3EjF8dV/K1i/4JPHv 6u6Vbm7jDGTLVm5hqwSw9TBSL6kL8X90e0Mc9AQ6KKgXaMRtzON+ua5vHe9iyuy2ZTEh kO9RXuhr7DKKTNNRlE0ZEfwI/GLBTZd6eKTZqhDiv+D7Of65xHKTAHLYaZGPmbV2KJ0w LKhEpLety+qyot/IefQxXAnA6PvebNfaLEIB1kd9EUThc+alcfyv7cH9vmYYWGzjOH1O 99LA== 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=0jOmp8sm+I0njEp1KAjAqRcU4CBb9i/a5zPESWjyQ0I=; b=3avCeziLWncHrc7dK1B4USVHnt1BlvtTKTotmrqA3DI5kSocHm0IwVg0HadP7g0R+9 ca9HzDWUqPOmn1ER+tgYkjOQp0d0Ga99ttMJZ7hO4Cfhu+TxHndC7m/aqwHGp+iipN+M +FxUoM5/yxYcyUeDGKfo0+j9hddtVWT+O0E7KSIVpZB9lpA291yh6VY6Ix0oO8VZ3CNt 7oYTAN502IrvblYnAyVj3ZMhPC0X8lcTfoGoKU8GtgDfktzI7h3XwBJpDHRdxLQMRvXK LFJ3igWeN8dGNX78mkpNy2LBn01CO5ctkJ1hfKl/yyNsKXnaPbqBIpKIX76VIo8oLKRq Dezg== X-Gm-Message-State: AOAM530/ZFy65t8rV5WrJQeYcQA95Z+KhGFhGglsTL5WewKVBspFUglt dfS/4QrNjCekT3Ozmm1maMxZDfYbOUYQ2w== X-Google-Smtp-Source: ABdhPJzHzUN2afFc27mPMSrQhbbV45BEK6gJ3/AiK+aRTxmfEA2szMo2G0Yd7j7GcERfa/utdywYLA== X-Received: by 2002:a5d:6389:: with SMTP id p9mr295197wru.125.1641580645954; Fri, 07 Jan 2022 10:37:25 -0800 (PST) Received: from localhost.localdomain ([185.39.42.151]) by smtp.gmail.com with ESMTPSA id b14sm5616018wrg.15.2022.01.07.10.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 10:37:25 -0800 (PST) From: Jorge Acereda Date: Fri, 7 Jan 2022 19:37:20 +0100 Message-Id: <6a263efbca6f379b056e06887de50e6cccac9929.1641580314.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=1641581084; 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=0jOmp8sm+I0njEp1KAjAqRcU4CBb9i/a5zPESWjyQ0I=; b=GRPkdWBMxdO0gMoBQxDoLsAoFY6rrgEsVD4s7Ebp6PbHiw+5t2DF4iAM8G/MytKP/4WWoh R6nV4FCaEcyKRVwUF8aFigMOvQZ7wcN1PU7MKI0u0T4LTFGHv4bGaOeguH+fhDCTHnFk9p 0UhwRwaZ0oFV4cA3bhSDngT8kIBCluBuAsOt2m7kCgq4MpnSn3ejHHFQYR8PmJkTqSzys8 UOboZs9XdDu9T4DXjxhrcA9tq2HjwA+4tED4+jd5J48TgiqjiEuVV2XDw4IQzNzoHyurK1 1ubBBvzY8Uyr3QrOWPo7GEA7RYkXCYrkLpQId4QuNO8CAs7rQAQa4MqumhbG6A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641581084; a=rsa-sha256; cv=none; b=jCbTT2kSCEbHbyvd+7LHCw9ciOpBHBs0nTD0kciS1SoauDRU80oRbcQa6mqLRQkqyUBV7y Nvf3DGcdkRk/ImdQyIr27IG45/rhSmIkIfarx1vhtYXegFNXT4fpSXwBascUaj4oU2GqwF 5Cwp8GizfpNCudRI4yMCrBF+VrU5+169qqImGKhoYDisL9fTcOII80yNNTObH7TcyUPH2B p1u6lj6nxUeSoZdsiongjF2ymW55NcPUAMUyknCyXL6BH2o4CK7niy/99x4w5hpRW8U0F3 /h5UbKeUc9eikvE/TIui9HCubTcXCERTotnQMHVroHJbp/Uny2g44YS6gif9EQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=FcAQhKLP; 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.00 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=FcAQhKLP; 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: 1ADC227286 X-Spam-Score: -1.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: niHKC566aQhV The package version is the same one used in nixpkgs (current tip). Should I add some "unstable" string somewhere? Also, I'm pretty sure I overcomplicated things, there must be some easier way to patch the executable paths. * gnu/packages/graphics.scm (gpu-switch): New variable. --- gnu/packages/graphics.scm | 58 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm index fe35aaad2d..d425a18c18 100644 --- a/gnu/packages/graphics.scm +++ b/gnu/packages/graphics.scm @@ -27,6 +27,7 @@ ;;; Copyright © 2021 Andy Tai ;;; Copyright © 2021 Ekaitz Zarraga ;;; Copyright © 2021 Vinicius Monego +;;; Copyright © 2022 Jorge Acereda ;;; ;;; This file is part of GNU Guix. ;;; @@ -113,12 +114,14 @@ (define-module (gnu packages graphics) #:use-module (guix build-system meson) #:use-module (guix build-system python) #:use-module (guix build-system qt) + #:use-module (guix build-system trivial) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix hg-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) - #:use-module (guix utils)) + #:use-module (guix utils) + #:use-module (ice-9 match)) (define-public mmm (package @@ -2011,4 +2014,56 @@ (define-public monado such as VR and AR on mobile, PC/desktop, and any other device. Monado aims to be a complete and conforming implementation of the OpenXR API made by Khronos.") (license license:boost1.0))) + +(define-public gpu-switch + (package + (name "gpu-switch") + (version "2017-04-28") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/0xbb/gpu-switch") + (commit "a365f56d435c8ef84c4dd2ab935ede4992359e31"))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1jnh43nijkqd83h7piq7225ixziggyzaalabgissyxdyz6szcn0r")))) + (build-system trivial-build-system) + (inputs + (list bash e2fsprogs util-linux grep coreutils which)) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils) (ice-9 match)) + (let* ((out (assoc-ref %outputs "out")) + (gpu-switch (search-input-file %build-inputs "gpu-switch")) + (bin (string-append out "/bin")) + (out-gpu-switch (string-append bin "/gpu-switch")) + (readme (search-input-file %build-inputs "README.md"))) + (install-file gpu-switch bin) + (for-each + (match-lambda + ((pkg . nm) (substitute* out-gpu-switch + ((nm) + (string-append (assoc-ref %build-inputs pkg) + "/bin/" nm))))) + '(("coreutils" . "basename") + ("bash" . "bash") + ("util-linux" . "mount") + ("which" . "which") + ("coreutils" . "cat") + ("e2fsprogs" . "chattr") + ("grep" . "grep"))) + (install-file readme (string-append out "/share/doc/gpu-switch-" ,version)) + #t)))) + (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