switch-homebrew.scm 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (switch-homebrew)
  19. #:use-module (guix packages)
  20. #:use-module (gnu packages)
  21. #:use-module ((guix licenses) #:prefix license:)
  22. #:use-module (guix download)
  23. #:use-module (guix git-download)
  24. #:use-module (guix utils)
  25. #:use-module (guix build-system gnu)
  26. #:use-module (guix build-system trivial)
  27. #:use-module (gnu build cross-toolchain)
  28. #:use-module (gnu packages cross-base)
  29. #:use-module (gnu packages embedded)
  30. #:use-module (gnu packages libusb)
  31. #:use-module (gnu packages python))
  32. (define-public fusee-launcher
  33. (package
  34. (name "fusee-launcher")
  35. (version "1.0")
  36. (source (origin
  37. (method git-fetch)
  38. (uri (git-reference
  39. (url "https://github.com/Qyriad/fusee-launcher.git")
  40. (commit version)))
  41. (file-name (git-file-name name version))
  42. (sha256
  43. (base32
  44. "1pqkgw5bk0xcz9x7pc1f0r0b9nsc8jnnvcs1315d8ml8mx23fshm"))))
  45. (build-system gnu-build-system)
  46. (arguments
  47. `(#:tests? #f ; no check target
  48. #:phases
  49. (modify-phases %standard-phases
  50. (replace 'configure
  51. (lambda* (#:key outputs #:allow-other-keys)
  52. (let* ((out (assoc-ref outputs "out"))
  53. (share (string-append out "/share/fusee-launcher")))
  54. ;; Patch the path to the intermezzo relocator binary.
  55. (substitute* "fusee-launcher.py"
  56. (("os\\.path\\.dirname\\(os\\.path\\.abspath\\(__file__\\)\\)")
  57. (string-append "'" share "'")))
  58. #t)))
  59. (replace 'install
  60. (lambda* (#:key outputs #:allow-other-keys)
  61. (let* ((out (assoc-ref outputs "out"))
  62. (bin (string-append out "/bin"))
  63. (share (string-append out "/share/fusee-launcher")))
  64. (install-file "fusee-launcher.py" bin)
  65. (install-file "intermezzo.bin" share)
  66. #t)))
  67. (add-after 'install 'wrap
  68. (lambda* (#:key inputs outputs #:allow-other-keys)
  69. (let* ((out (assoc-ref outputs "out"))
  70. (pyusb (assoc-ref inputs "python-pyusb"))
  71. (sitedir
  72. (lambda (package)
  73. (string-append package
  74. "/lib/python"
  75. ,(version-major+minor
  76. (package-version python))
  77. "/site-packages")))
  78. (PYTHONPATH (sitedir pyusb)))
  79. (wrap-program (string-append out "/bin/fusee-launcher.py")
  80. `("PYTHONPATH" ":" prefix (,PYTHONPATH)))
  81. #t))))))
  82. (native-inputs
  83. `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
  84. ("xgcc" ,gcc-arm-none-eabi-6)))
  85. (inputs
  86. `(("python" ,python)
  87. ("python-pyusb" ,python-pyusb)))
  88. (home-page "https://github.com/Qyriad/fusee-launcher")
  89. (synopsis "Launcher for one of the Tegra X1 bootROM exploits")
  90. (description
  91. "fusee-launcher is a launcher for Fusée Gelée, a coldboot vulnerability
  92. that allows full, unauthenticated arbitrary code execution from an early bootROM
  93. context via Tegra Recovery Mode (RCM) on NVIDIA's Tegra line of embedded
  94. processors.")
  95. (license license:gpl2)))