nim.scm 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.org>
  3. ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
  4. ;;; Copyright © 2018, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages nim)
  22. #:use-module (guix build-system gnu)
  23. #:use-module (guix download)
  24. #:use-module ((guix licenses) #:prefix license:)
  25. #:use-module (guix packages))
  26. (define-public nim
  27. (package
  28. (name "nim")
  29. (version "1.4.6")
  30. (source
  31. (origin
  32. (method url-fetch)
  33. (uri (string-append "https://nim-lang.org/download/"
  34. name "-" version ".tar.xz"))
  35. (sha256
  36. (base32 "1gfkk15q022s31ffbsm2lbfrsnsjfslbyixwk7g8bzngha90zg0g"))))
  37. (build-system gnu-build-system)
  38. (arguments
  39. `(#:tests? #f ; No tests.
  40. #:phases
  41. (modify-phases %standard-phases
  42. (delete 'configure) ; no configure script
  43. (add-after 'unpack 'patch-installer
  44. (lambda* (#:key outputs #:allow-other-keys)
  45. (let ((out (assoc-ref outputs "out")))
  46. (substitute* "install.sh"
  47. (("1/nim") "1"))
  48. #t)))
  49. (add-after 'patch-source-shebangs 'patch-more-shebangs
  50. (lambda _
  51. (let ((sh (which "sh")))
  52. (substitute* '("tests/stdlib/tosprocterminate.nim"
  53. "lib/pure/osproc.nim")
  54. (("/bin/sh") sh))
  55. (substitute* (find-files "c_code" "stdlib_osproc.c")
  56. (("\"/bin/sh\", 7") (format #f "~s, ~s" sh (string-length sh)))))
  57. #t))
  58. (replace 'build
  59. (lambda _
  60. (invoke "sh" "build.sh")
  61. #t))
  62. (replace 'install
  63. (lambda* (#:key outputs #:allow-other-keys)
  64. (let ((out (assoc-ref outputs "out")))
  65. (invoke "./install.sh" out)
  66. #t))))))
  67. (home-page "https://nim-lang.org")
  68. (synopsis "Statically-typed, imperative programming language")
  69. (description "Nim (formerly known as Nimrod) is a statically-typed,
  70. imperative programming language that tries to give the programmer ultimate power
  71. without compromises on runtime efficiency. This means it focuses on compile-time
  72. mechanisms in all their various forms.")
  73. (license license:expat)))