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