* [bug#53059] [PATCH] gnu: Add gpu-switch. @ 2022-01-06 19:11 Jorge Acereda 2022-01-06 21:01 ` Maxime Devos ` (3 more replies) 0 siblings, 4 replies; 7+ messages in thread From: Jorge Acereda @ 2022-01-06 19:11 UTC (permalink / raw) To: 53059; +Cc: Jorge Acereda [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=yes, Size: 2586 bytes --] * gnu/packages/graphics.scm (gpu-switch): New variable. --- gnu/packages/graphics.scm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm index fe35aaad2d..b5b50f6192 100644 --- a/gnu/packages/graphics.scm +++ b/gnu/packages/graphics.scm @@ -27,6 +27,7 @@ ;;; Copyright © 2021 Andy Tai <atai@atai.org> ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech> ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net> +;;; Copyright © 2022 Jorge Acereda <jacereda@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -113,6 +114,7 @@ (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) @@ -2011,3 +2013,39 @@ (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) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let ((out (assoc-ref %outputs "out")) + (gpu-switch (search-input-file %build-inputs "gpu-switch")) + (readme (search-input-file %build-inputs "README.md"))) + (install-file gpu-switch (string-append out "/bin")) + (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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#53059] [PATCH] gnu: Add gpu-switch. 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 18:37 ` [bug#53059] [PATCH v2] " Jorge Acereda ` (2 subsequent siblings) 3 siblings, 1 reply; 7+ messages in thread From: Maxime Devos @ 2022-01-06 21:01 UTC (permalink / raw) To: 53059; +Cc: Jorge Acereda [-- Attachment #1: Type: text/plain, Size: 928 bytes --] Hi, Looking at <https://github.com/0xbb/gpu-switch/blob/master/gpu-switch>, it appears that it uses 'chattr', 'mount', 'grep', 'cat' and 'basename'. So the corresponding packages would need to be added to 'inputs' and a few 'substitute*' are required such that gpu-switch doesn't require 'chattr' & friends to be in the environment. /sys/firmware/efi/efivars is rather Linux-specific, presumably non-existent on the hurd, so the hurd systems need to be removed from supported-systems. > + (name "gpu-switch") > + (version "2017-04-28") > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/0xbb/gpu-switch") > + (commit "a365f56d435c8ef84c4dd2ab935ede4992359e31"))) Where did you get this version/commit pair from? I'm not seeing it on <https://github.com/0xbb/gpu-switch/releases>. Greetings, Maxime. [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 260 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <87pmp42w9k.fsf@gmail.com>]
* [bug#53059] [PATCH] gnu: Add gpu-switch. [not found] ` <87pmp42w9k.fsf@gmail.com> @ 2022-01-07 10:45 ` Maxime Devos 0 siblings, 0 replies; 7+ messages in thread From: Maxime Devos @ 2022-01-07 10:45 UTC (permalink / raw) To: Jorge Acereda; +Cc: 53059 [-- Attachment #1: Type: text/plain, Size: 730 bytes --] [Re-adding debbugs to CC] Jorge Acereda schreef op vr 07-01-2022 om 02:02 [+0100]: > [...] > > > > /sys/firmware/efi/efivars is rather Linux-specific, presumably > > non-existent on the hurd, so the hurd systems need to be removed from > > supported-systems. > > Would it be better in linux.scm instead? While it currently is Linux-specific, in principle it could be ported to the Hurd, a BSD or Windows or whatever -- in fact, looking at https://github.com/0xbb/gpu-switch, it appears to support ‘osx’ and Windows. linux.scm is more for Linux kernel modules, the Linux kernel, userspace bindings to kernel syscalls ... There probably are a few misplaced packages in linux.scm. Greetings, Maxime [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 260 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#53059] [PATCH v2] gnu: Add gpu-switch. 2022-01-06 19:11 [bug#53059] [PATCH] gnu: Add gpu-switch Jorge Acereda 2022-01-06 21:01 ` Maxime Devos @ 2022-01-07 18:37 ` Jorge Acereda 2022-01-08 15:38 ` Maxime Devos 2022-01-08 19:42 ` [bug#53059] [PATCH v3] " Jorge Acereda 2022-01-08 19:53 ` [bug#53059] [PATCH v4] " Jorge Acereda 3 siblings, 1 reply; 7+ messages in thread From: Jorge Acereda @ 2022-01-07 18:37 UTC (permalink / raw) To: 53059; +Cc: Jorge Acereda [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=yes, Size: 3762 bytes --] 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 <atai@atai.org> ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech> ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net> +;;; Copyright © 2022 Jorge Acereda <jacereda@gmail.com> ;;; ;;; 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#53059] [PATCH v2] gnu: Add gpu-switch. 2022-01-07 18:37 ` [bug#53059] [PATCH v2] " Jorge Acereda @ 2022-01-08 15:38 ` Maxime Devos 0 siblings, 0 replies; 7+ messages in thread From: Maxime Devos @ 2022-01-08 15:38 UTC (permalink / raw) To: Jorge Acereda, 53059 [-- Attachment #1: Type: text/plain, Size: 8143 bytes --] Jorge Acereda schreef op vr 07-01-2022 om 19:37 [+0100]: > 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. Ok, but anyone looking at the package definition of gpu-switch would be having a hard time figuring out these reasons. Also, the version used by nixpkgs isn't very relevant; nixpkgs might be out-of-date. An "-unstable" version suffix isn't very informative, and doesn't seem correct here: there haven't been any changes in gpu-switch for about five years, which seems rather stable to me. I suggest having a look at ‘17.4.3 Version Numbers’ in the manual, in particular the text about VCS vs formal releases. Because upstream isn't formally releasing anything, using a revision from git seems appropriate to me, but the reasons needs to be documented with a comment. E.g., see 'emacs-graphql-mode'. > * 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 GPUs aren't only used for graphics, see e.g. <https://boinc.berkeley.edu/wiki/GPU_computing>. I would put it in hardware.scm instead. > @@ -27,6 +27,7 @@ > ;;; Copyright © 2021 Andy Tai <atai@atai.org> > ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech> > ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net> > +;;; Copyright © 2022 Jorge Acereda <jacereda@gmail.com> > ;;; > ;;; 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)) Not needed, the use of 'match' is only at the build side. > > (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)) I suggest bash-minimal and coreutils-minimal to reduce the closure. > + (arguments > + `(#:modules ((guix build utils)) > + #:builder > + (begin > + (use-modules (guix build utils) (ice-9 match)) > + (let* ((out (assoc-ref %outputs "out")) %outputs is sort-of deprecated, it is recommended to use G-exps instead: (let* ((out #$output) ...) ...) > + (gpu-switch (search-input-file %build-inputs "gpu-switch")) Likewise, %build-inputs is deprecated, and it doesn't do the right thing when cross-compiling, because (implicit) native inputs go before native inputs. In this particular case, it would work, but I'd avoid this fragility, by doing something like (let (... (inputs #$inputs) (gpu-switch (search-input-file inputs "gpu-switch"))) ...) instead. Personally, I'd do #$(file-append source "/gpu-switch") instead though. > + (bin (string-append out "/bin")) > + (out-gpu-switch (string-append bin "/gpu-switch")) > + (readme (search-input-file %build-inputs "README.md"))) Likewise. > + (install-file gpu-switch bin) The shebang starts with #!/usr/bin/env /gnu/store/[a hash]-bash-5.1.8/bin/bash so the script depends on the system's /usr/bin/env. Can this dependency be removed, e.g. using patch-shebang? The script has a line $(/gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename $0) --integrated # Switch to the integrated GPU but this is fragile, what if I create a symlink named "switch the gpu" pointing to gpu-switch (without the quotes, and with the spaces)? Then I get $ ./switch\ the\ gpu /gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename: extra operand 'gpu' Try '/gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename --help' for more information. /gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename: extra operand 'gpu' Try '/gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename --help' for more information. /gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename: extra operand 'gpu' Try '/gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/basename --help' for more information. Can this be fixed (upstream)? Putting "" around the $0 would probably be enough. Also, I thought it might be required to place -- before the "$0" (in case the symlink is named "--help"), but it seems to work without in my tests. I would still recommend an -- argument though, to make things less fragile. > + (for-each > + (match-lambda > + ((pkg . nm) (substitute* out-gpu-switch I see the following line in the output of "gpu-switch" gpu-switch --dedi/gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl- coreutils-8.32/bin/cated # Switch to the dedi/gnu/store/y5jxkx484x7s2c2n7dc8wprh5sbps7pl-coreutils- 8.32/bin/cated GPU Likewise: printf "Fatal: Couldn't /gnu/store/64d0mxsjqifrpashlhyd3rf7zm2r709x-util-linux-2.37.1/bin/mount '${sysfs_efi_vars}'.\n" 1>&2 Seems like the substitutions are not sufficiently specific. > + ((nm) > + (string-append (assoc-ref %build-inputs pkg) %build-inputs -> #$inputs? Or maybe even use search-input-file. Also, you can substitute multiple things with a single substitute*. E.g., ;; From the manual, see (guix)Build Utilities (substitute* file (("hello") "good morning\n") (("foo([a-z]+)bar(.*)$" all letters end) (string-append "baz" letter end))) > + #t)))) Returning #true in phases is not required anymore, presumably the same holds for #:builder. > + (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. Is this specific for ‘MacBook Pro models’, or does it work for any computer that has a certain combination of ‘integrated’ and ‘dedicated’ GPU? > +It aims to remove the need of booting into OS X and running gfxCardStatus > +v2.2.1 to switch to the integrated card.") Is this v2.2.1 important? Greetings, Maxime. [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 260 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#53059] [PATCH v3] gnu: Add gpu-switch. 2022-01-06 19:11 [bug#53059] [PATCH] gnu: Add gpu-switch Jorge Acereda 2022-01-06 21:01 ` Maxime Devos 2022-01-07 18:37 ` [bug#53059] [PATCH v2] " Jorge Acereda @ 2022-01-08 19:42 ` Jorge Acereda 2022-01-08 19:53 ` [bug#53059] [PATCH v4] " Jorge Acereda 3 siblings, 0 replies; 7+ messages in thread From: Jorge Acereda @ 2022-01-08 19:42 UTC (permalink / raw) To: 53059; +Cc: Jorge Acereda [-- 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#53059] [PATCH v4] gnu: Add gpu-switch. 2022-01-06 19:11 [bug#53059] [PATCH] gnu: Add gpu-switch Jorge Acereda ` (2 preceding siblings ...) 2022-01-08 19:42 ` [bug#53059] [PATCH v3] " Jorge Acereda @ 2022-01-08 19:53 ` Jorge Acereda 3 siblings, 0 replies; 7+ messages in thread From: Jorge Acereda @ 2022-01-08 19:53 UTC (permalink / raw) To: 53059; +Cc: Jorge Acereda [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=yes, Size: 3672 bytes --] 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 <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,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)))) -- 2.34.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-08 19:54 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [bug#53059] [PATCH v3] " Jorge Acereda 2022-01-08 19:53 ` [bug#53059] [PATCH v4] " Jorge Acereda
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).