code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages nim)
  #:use-module (guix build-system gnu)
  #:use-module (guix download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

(define-public nim
  (package
    (name "nim")
    (version "0.17.2")
    (source
     (origin
      (method url-fetch)
      (uri (string-append "https://nim-lang.org/download/"
                          name "-" version ".tar.xz"))
      (sha256
       (base32
        "1gc2xk3ygmz9y4pm75pligssgw995a7gvnfpy445fjpw4d81pzxa"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f ; No tests.
       #:phases
         (modify-phases %standard-phases
           (delete 'configure)          ; no configure script
           (add-after 'unpack 'patch-installer
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
                 (substitute* "install.sh"
                   (("1/nim") "1"))
                 #t)))
           (add-after 'patch-source-shebangs 'patch-more-shebangs
             (lambda _
               (substitute* (append '("tests/stdlib/tosprocterminate.nim"
                                      "lib/pure/osproc.nim")
                                    (find-files "c_code" "stdlib_osproc.c"))
                 (("/bin/sh") (which "sh")))
               #t))
           (replace 'build
             (lambda _
               (invoke "sh" "build.sh")
               #t))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
                 (invoke "./install.sh" out)
                 #t))))))
    (home-page "https://nim-lang.org")
    (synopsis "Statically-typed, imperative programming language")
    (description "Nim (formerly known as Nimrod) is a statically-typed,
imperative programming language that tries to give the programmer ultimate power
without compromises on runtime efficiency.  This means it focuses on compile-time
mechanisms in all their various forms.")
    (license license:expat)))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ninja)
  #:use-module ((guix licenses) #:select (asl2.0))
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages python))

(define-public ninja
  (package
    (name "ninja")
    (version "1.8.2")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/martine/ninja/"
                                  "archive/v" version ".tar.gz"))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "1x66q6494ml1p1f74mxzik1giakl4zj7rxig9jsc50087l671f46"))))
    (build-system gnu-build-system)
    (native-inputs `(("python" ,python-2)))
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda _
             (substitute* "src/subprocess-posix.cc"
               (("/bin/sh") (which "sh")))
             (substitute* "src/subprocess_test.cc"
               (("/bin/echo") (which "echo")))
             #t))
         (replace 'build
           (lambda _
             (invoke "./configure.py" "--bootstrap")))
         (replace 'check
           (lambda _
             (invoke "./configure.py")
             (invoke "./ninja" "ninja_test")
             (invoke "./ninja_test")))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (doc (string-append out "/share/doc/ninja")))
               (install-file "ninja" bin)
               (install-file "doc/manual.asciidoc" doc)
               #t))))))
    (home-page "https://ninja-build.org/")
    (synopsis "Small build system")
    (description
     "Ninja is a small build system with a focus on speed.  It differs from
other build systems in two major respects: it is designed to have its input
files generated by a higher-level build system, and it is designed to run
builds as fast as possible.")
    (license asl2.0)))

license: mit


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mike Gerwitz <mtg@gnu.org>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages node)
  #:use-module ((guix licenses) #:select (expat))
  #:use-module (guix packages)
  #:use-module (guix derivations)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages adns)
  #:use-module (gnu packages base)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages libevent)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages web))

(define-public node
  (package
    (name "node")
    (version "9.11.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://nodejs.org/dist/v" version
                                  "/node-v" version ".tar.gz"))
              (sha256
               (base32
                "1vjh9zvw7wkdz6b0l99ya7mqjk0l8lbg9isr1q8rxwp400dhkk32"))
              (modules '((guix build utils)))
              (snippet
               `(begin
                  ;; Remove bundled software.
                  (for-each delete-file-recursively
                            '("deps/cares"
                              "deps/http_parser"
                              "deps/icu-small"
                              "deps/nghttp2"
                              "deps/openssl"
                              "deps/uv"
                              "deps/zlib"))
                  (substitute* "Makefile"
                    ;; Remove references to bundled software.
                    (("deps/http_parser/http_parser.gyp") "")
                    (("deps/uv/include/\\*.h") "")
                    (("deps/uv/uv.gyp") "")
                    (("deps/zlib/zlib.gyp") ""))
                  #t))))
    (build-system gnu-build-system)
    (arguments
     ;; TODO: Purge the bundled copies from the source.
     '(#:configure-flags '("--shared-cares"
                           "--shared-http-parser"
                           "--shared-libuv"
                           "--shared-nghttp2"
                           "--shared-openssl"
                           "--shared-zlib"
                           "--without-snapshot"
                           "--with-intl=system-icu")
       #:phases
       (modify-phases %standard-phases
         (add-before 'configure 'patch-files
           (lambda* (#:key inputs #:allow-other-keys)

             ;; This phase is inherited by Node LTS, which does not have all
             ;; the files listed here.  Use this helper for convenience.
             (define (delete-if-exists file)
               (if (file-exists? file)
                   (delete-file file)
                   '()))

             ;; Fix hardcoded /bin/sh references.
             (substitute* '("lib/child_process.js"
                            "lib/internal/v8_prof_polyfill.js"
                            "test/parallel/test-child-process-spawnsync-shell.js"
                            "test/parallel/test-stdio-closed.js")
               (("'/bin/sh'")
                (string-append "'" (which "sh") "'")))

             ;; Fix hardcoded /usr/bin/env references.
             (substitute* '("test/parallel/test-child-process-default-options.js"
                            "test/parallel/test-child-process-env.js"
                            "test/parallel/test-child-process-exec-env.js")
               (("'/usr/bin/env'")
                (string-append "'" (which "env") "'")))

             ;; FIXME: These tests depend on being able to install eslint.
             ;; See https://github.com/nodejs/node/issues/17098.
             (for-each delete-if-exists
                       '("test/parallel/test-eslint-alphabetize-errors.js"
                         "test/parallel/test-eslint-buffer-constructor.js"
                         "test/parallel/test-eslint-documented-errors.js"
                         "test/parallel/test-eslint-inspector-check.js"))

             ;; FIXME: These tests fail in the build container, but they don't
             ;; seem to be indicative of real problems in practice.
             (for-each delete-if-exists
                       '("test/async-hooks/test-ttywrap.readstream.js"
                         "test/parallel/test-util-inspect.js"
                         "test/parallel/test-v8-serdes.js"
                         "test/parallel/test-dgram-membership.js"
                         "test/parallel/test-dns-cancel-reverse-lookup.js"
                         "test/parallel/test-dns-resolveany.js"
                         "test/parallel/test-cluster-master-error.js"
                         "test/parallel/test-cluster-master-kill.js"
                         "test/parallel/test-net-listen-after-destroying-stdin.js"
                         "test/parallel/test-npm-install.js"
                         "test/sequential/test-child-process-emfile.js"
                         "test/sequential/test-benchmark-child-process.js"
                         "test/sequential/test-http-regr-gh-2928.js"))

             ;; These tests have an expiry date: they depend on the validity of
             ;; TLS certificates that are bundled with the source.  We want this
             ;; package to be reproducible forever, so remove those.
             ;; TODO: Regenerate certs instead.
             (for-each delete-if-exists
                       '("test/parallel/test-tls-passphrase.js"
                         "test/parallel/test-tls-server-verify.js"))
             #t))
         (replace 'configure
           ;; Node's configure script is actually a python script, so we can't
           ;; run it with bash.
           (lambda* (#:key outputs (configure-flags '()) inputs
                     #:allow-other-keys)
             (let* ((prefix (assoc-ref outputs "out"))
                    (flags (cons (string-append "--prefix=" prefix)
                                 configure-flags)))
               (format #t "build directory: ~s~%" (getcwd))
               (format #t "configure flags: ~s~%" flags)
               ;; Node's configure script expects the CC environment variable to
               ;; be set.
               (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
               (apply invoke
                      (string-append (assoc-ref inputs "python")
                                     "/bin/python")
                      "configure" flags))))
         (add-after 'patch-shebangs 'patch-npm-shebang
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((bindir (string-append (assoc-ref outputs "out")
                                           "/bin"))
                    (npm    (string-append bindir "/npm"))
                    (target (readlink npm)))
               (with-directory-excursion bindir
                 (patch-shebang target (list bindir))
                 #t)))))))
    (native-inputs
     `(("python" ,python-2)
       ("perl" ,perl)
       ("pkg-config" ,pkg-config)
       ("procps" ,procps)
       ("util-linux" ,util-linux)
       ("which" ,which)))
    (native-search-paths
     (list (search-path-specification
            (variable "NODE_PATH")
            (files '("lib/node_modules")))))
    (inputs
     `(("c-ares" ,c-ares)
       ("http-parser" ,http-parser)
       ("icu4c" ,icu4c)
       ("libuv" ,libuv)
       ("nghttp2" ,nghttp2 "lib")
       ("openssl" ,openssl)
       ("zlib" ,zlib)))
    (synopsis "Evented I/O for V8 JavaScript")
    (description "Node.js is a platform built on Chrome's JavaScript runtime
for easily building fast, scalable network applications.  Node.js uses an
event-driven, non-blocking I/O model that makes it lightweight and efficient,
perfect for data-intensive real-time applications that run across distributed
devices.")
    (home-page "https://nodejs.org/")
    (license expat)
    (properties '((timeout . 3600))))) ; 1 h

(define-public node-lts
  (package
    (inherit node)
    (name "node-lts")
    (version "8.12.0")
    (source (origin
              (inherit (package-source node))
              (uri (string-append "https://nodejs.org/dist/v" version
                                  "/node-v" version ".tar.xz"))
              (sha256
               (base32
                "16j1rrxkhmvpcw689ndw1raql1gz4jqn7n82z55zn63c05cgz7as"))))))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages noweb)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix licenses))

(define-public noweb
  (package
    (name "noweb")
    (version "2.11b")
    (source (origin
             (method url-fetch)
             (uri (string-append "ftp://www.eecs.harvard.edu/pub/nr/noweb-"
                                 version ".tgz"))
             (sha256
              (base32
               "10hdd6mrk26kyh4bnng4ah5h1pnanhsrhqa7qwqy6dyv3rng44y9"))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'install 'pre-install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (mkdir-p (string-append out "/share/texmf/tex/latex"))
               #t)))
         (add-after 'install 'post-install
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (cu  (assoc-ref inputs "coreutils"))
                   (du  (assoc-ref inputs "diffutils")))
               (with-directory-excursion out
                 (for-each (lambda (prog)
                             (substitute* prog
                               (("nawk") (which "awk"))))
                           (append (map (lambda (x)
                                          (string-append "bin/" x))
                                        '("noweb" "nountangle"
                                          "noroots" "noroff"
                                          "noindex"))
                                   (map (lambda (x)
                                          (string-append "lib/" x))
                                        '("btdefn" "emptydefn" "noidx"
                                          "pipedocs" "toascii" "tohtml"
                                          "toroff" "totex" "unmarkup"))))
                 (substitute* "bin/cpif"
                   (("^PATH=.*$")
                    (string-append "PATH=" cu "/bin:" du "/bin\n"))))
               #t)))
         (replace 'configure
           (lambda _
             ;; Jump in the source.
             (chdir "src")

             ;; The makefile reads "source: FAQ", but FAQ isn't
             ;; available.
             (substitute* "Makefile"
               (("FAQ") ""))
             #t)))
       #:make-flags (let ((out (assoc-ref %outputs "out")))
                      (list (string-append "BIN=" out "/bin")
                            (string-append "LIB=" out "/lib")
                            (string-append "MAN=" out "/share/man")
                            (string-append "TEXINPUTS=" out
                                           "/share/texmf/tex/latex")))
       #:tests? #f))                              ; no tests
    (home-page "http://www.cs.tufts.edu/~nr/noweb/")
    (synopsis "Literate programming tool")
    (description
     "Noweb is designed to meet the needs of literate programmers while
remaining as simple as possible.  Its primary advantages are simplicity,
extensibility, and language-independence—especially noticeable when compared
with other literate-programming tools.  noweb uses 5 control sequences to
WEB's 27.  The noweb manual is only 4 pages; an additional page explains how
to customize its LaTeX output.  noweb works “out of the box” with any
programming language, and supports TeX, LaTeX, HTML, and troff back ends.")
    (license (fsf-free "http://www.cs.tufts.edu/~nr/noweb/#copyright"))))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 John Darrington <jmd@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ntp)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages libevent)
  #:use-module ((guix licenses) #:prefix l:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (srfi srfi-1))

(define-public ntp
  (package
   (name "ntp")
   (version "4.2.8p12")
   (source
     (origin
       (method url-fetch)
       (uri (list (string-append
                    "http://archive.ntp.org/ntp4/ntp-"
                    (version-major+minor version)
                    "/ntp-" version ".tar.gz")
                  (string-append
                    "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
                    (version-major+minor version)
                    "/ntp-" version ".tar.gz")))
       (sha256
        (base32
         "0m04ndn0674kcf9x0aggjya07a3hlig2nlzzpwk7vmqka0mj56vh"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           ;; Remove the bundled copy of libevent, but we must keep
           ;; sntp/libevent/build-aux since configure.ac contains
           ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
           (rename-file "sntp/libevent/build-aux"
                        "sntp/libevent:build-aux")
           (delete-file-recursively "sntp/libevent")
           (mkdir "sntp/libevent")
           (rename-file "sntp/libevent:build-aux"
                        "sntp/libevent/build-aux")
           #t))))
   (native-inputs `(("which" ,which)
                    ("pkg-config" ,pkg-config)))
   (inputs
    `(("openssl" ,openssl)
      ("libevent" ,libevent)
      ;; Build with POSIX capabilities support on GNU/Linux.  This allows 'ntpd'
      ;; to run as non-root (when invoked with '-u'.)
      ,@(if (string-suffix? "-linux"
                            (or (%current-target-system) (%current-system)))
            `(("libcap" ,libcap))
            '())))
   (arguments
    `(#:phases
      (modify-phases %standard-phases
        (add-after 'unpack 'disable-network-test
                   (lambda _
                     (substitute* "tests/libntp/Makefile.in"
                       (("test-decodenetnum\\$\\(EXEEXT\\) ") ""))
                     #t)))))
   (build-system gnu-build-system)
   (synopsis "Real time clock synchronization system")
   (description "NTP is a system designed to synchronize the clocks of
computers over a network.")
   (license (l:x11-style
             "http://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
             "A non-copyleft free licence from the University of Delaware"))
   (home-page "http://www.ntp.org")))

(define-public openntpd
  (package
    (name "openntpd")
    (version "6.2p3")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz"))
              (sha256
               (base32
                "0fn12i4kzsi0zkr4qp3dp9bycmirnfapajqvdfx02zhr4hanj0kv"))))
    (build-system gnu-build-system)
    (arguments
     '(#:configure-flags '("--with-privsep-user=ntpd"
                           "--localstatedir=/var")
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'modify-install-locations
           (lambda _
             ;; Don't try to create /var/run or /var/db
             (substitute* "src/Makefile.in"
               (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR"))
             #t)))))
    (inputs
     `(("libressl" ,libressl))) ; enable TLS time constraints. See ntpd.conf(5).
    (home-page "http://www.openntpd.org/")
    (synopsis "NTP client and server by the OpenBSD Project")
    (description "OpenNTPD is the OpenBSD Project's implementation of a client
and server for the Network Time Protocol.  Its design goals include being
secure, easy to configure, and accurate enough for most purposes, so it's more
minimalist than ntpd.")
    ;; A few of the source files are under bsd-3.
    (license (list l:isc l:bsd-3))))

(define-public tlsdate
  (package
    (name "tlsdate")
    (version "0.0.13")
    (home-page "https://github.com/ioerror/tlsdate")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (commit (string-append "tlsdate-" version))
                    (url home-page)))
              (sha256
               (base32
                "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl"))
              (file-name (string-append name "-" version "-checkout"))))
    (build-system gnu-build-system)
    (arguments
     `(;; Disable seccomp when it's not supported--e.g., on aarch64.  See
       ;; 'src/seccomp.c' for the list of supported systems.
       #:configure-flags ,(if (any (lambda (system)
                                     (string-contains (or
                                                       (%current-target-system)
                                                       (%current-system))
                                                      system))
                                   '("x86_64" "i686" "arm"))
                              ''()
                              ''("--disable-seccomp-filter"))

       #:phases (modify-phases %standard-phases
                  (add-after 'unpack 'autogen
                    (lambda _
                      ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the
                      ;; date that is recorded in binaries.  It must be a
                      ;; "recent date" since it is used to detect bogus dates
                      ;; received from servers.
                      (setenv "COMPILE_DATE" (number->string 1530144000))
                      (invoke "sh" "autogen.sh"))))))
    (inputs `(("openssl" ,openssl)
              ("libevent" ,libevent)))
    (native-inputs `(("pkg-config" ,pkg-config)
                     ("autoconf" ,autoconf)
                     ("automake" ,automake)
                     ("libtool" ,libtool)))
    (synopsis "Extract remote time from TLS handshakes")
    (description
     "@command{tlsdate} sets the local clock by securely connecting with TLS
to remote servers and extracting the remote time out of the secure handshake.
Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a
remote HTTPS or TLS enabled service, and provides some protection against
adversaries that try to feed you malicious time information.")
    (license l:bsd-3)))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages nutrition)
  #:use-module (guix packages)
  #:use-module (guix licenses)
  #:use-module (guix download)
  #:use-module (guix build-system python)
  #:use-module (gnu packages)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages image)
  #:use-module (gnu packages python))

(define-public gourmet
  (package
    (name "gourmet")
    (version "0.17.4")
    (source
     (origin
      (method url-fetch)
      (uri (string-append "https://github.com/thinkle/gourmet/archive/"
                          version ".tar.gz"))
      (file-name (string-append name "-" version ".tar.gz"))
      (sha256
       (base32
        "1qvz175arzqm10lpfx8ffadrgirs3240zzqcp0h7sl53qfwx7v8k"))))
    (build-system python-build-system)
    (native-inputs
     `(("distutils-extra"   ,python2-distutils-extra)
       ("intltool"          ,intltool)
       ("python-pygtk"      ,python2-pygtk))) ;for tests
    ;; TODO: Add python-reportlab and/or python-poppler for printing/pdf
    ;; export, and python-beautifulsoup for web import plugin.
    (inputs
     `(("pygtk"             ,python2-pygtk)
       ("sqlalchemy"        ,python2-sqlalchemy)
       ("python-lxml"       ,python2-lxml)
       ("python-pillow"     ,python2-pillow)
       ("elib.intl"         ,python2-elib.intl)))
    (arguments
     `(#:python ,python-2               ;exception and print syntax
       #:tests? #f                      ;tests look bitrotted
       #:phases
       (modify-phases %standard-phases
         (replace 'install
           (lambda* (#:key make-flags #:allow-other-keys)
             (invoke "python" "setup.py" "install" "--prefix"
                     (assoc-ref %outputs "out")))))))
    (home-page "https://thinkle.github.io/gourmet/")
    (synopsis "Recipe organizer")
    (description
     "Gourmet Recipe Manager is a recipe organizer that allows you to collect,
search, organize, and browse your recipes.  Gourmet can also generate shopping
lists and calculate nutritional information.  It imports Mealmaster,
MasterCook and KRecipe files and exports PDFs, webpages, and other formats.")
    (license gpl2+)))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Marek Benc <merkur32@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages nvi)
  #:use-module (gnu packages)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages ncurses)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix licenses))

(define-public nvi
  (package
    (name "nvi")
    (version "1.81.6")
    (source
      (origin
        (method url-fetch)
        (uri          ;; sites.google.coma/bostic.com/keithbostic/vi is stale.
          (string-append "http://harrier.slackbuilds.org/misc/nvi-" version
                         ".tar.bz2"))
        (sha256
          (base32 "0nbbs1inyrqds0ywn3ln5slv54v5zraq7lszkg8nsavv4kivhh9l"))
        (patches (search-patches "nvi-assume-preserve-path.patch"
                                 "nvi-dbpagesize-binpower.patch"
                                 "nvi-db4.patch"))
        (snippet
          ;; Create a wrapper for the configure script, make it executable.
          '(let ((conf-wrap (open-output-file "configure")))
             (display "#!/bin/sh" conf-wrap)
             (newline conf-wrap)
             (display
               "../nvi-1.81.6/dist/configure --srcdir=../nvi-1.81.6/dist $@"
               conf-wrap)
             (newline conf-wrap)
             (close-output-port conf-wrap)
             (chmod "configure" #o0755)
             #t))))

    (build-system gnu-build-system)
    (arguments
      `(#:out-of-source? #t
        #:configure-flags '("--enable-widechar")))
    (inputs
      `(("bdb" ,bdb)
        ("ncurses" ,ncurses)))
    (synopsis "The Berkeley Vi Editor")
    (description
      "Vi is the original screen based text editor for Unix systems.  It is
considered the standard text editor, and is available on almost all Unix
systems.  Nvi is intended as a \"bug-for-bug compatible\" clone of the original
BSD vi editor.  As such, it doesn't have a lot of snazzy features as do some
of the other vi clones such as elvis and vim.  However, if all you want is vi,
this is the one to get.")
    (home-page "https://sites.google.com/a/bostic.com/keithbostic/vi")
    (license bsd-3)))