aboutsummaryrefslogtreecommitdiff
path: root/build-aux/compile-as-derivation.scm
blob: d945a8c79c6670870bccc6de3cfffc4d50880cce (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 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/>.

;; Build Guix using Guix.

(use-modules (srfi srfi-26))

;; Add ~/.config/guix/current to the search path.
(eval-when (expand load eval)
  (and=> (or (getenv "XDG_CONFIG_HOME")
             (and=> (getenv "HOME")
                    (cut string-append <> "/.config/guix/current")))
         (lambda (current)
           (set! %load-path
             (cons (string-append current "/share/guile/site/"
                                  (effective-version))
                   %load-path))
           (set! %load-compiled-path
             (cons (string-append current "/lib/guile/" (effective-version)
                                  "/site-ccache")
                   %load-compiled-path)))))

(use-modules (guix) (guix ui)
             (guix git-download)
             (ice-9 match))

(match (command-line)
  ((program source)
   (with-error-handling
     (with-store store
       (let* ((script (string-append source "/build-aux/build-self.scm"))
              (build  (primitive-load script))
              (git?   (git-predicate source)))
         (run-with-store store
           ;; TODO: Extract #:version and #:commit using Guile-Git.
           (mlet* %store-monad ((source (interned-file source "guix-source"
                                                       #:select? git?
                                                       #:recursive? #t))
                                (drv    (build source #:pull-version 1)))
             (mbegin %store-monad
               (show-what-to-build* (list drv))
               (built-derivations (list drv))
               (with-monad %store-monad
                 (display (derivation->output-path drv))
                 (newline)
                 (return drv))))))))))
separate module....Ricardo Wurmus 2019-01-15gnu: guile-commonmark: Install .scm files in the right place....Ludovic Courtès 2019-01-14gnu: guile-json: Add 3.1.0....Ludovic Courtès 2019-01-12gnu: Sort package modules in (gnu packages guile)....Ricardo Wurmus 2018-12-27gnu: Add guile-mastodon....Pierre-Antoine Rouby 2018-12-16gnu: guile: Do not warn about 'madvise' ENOSYS on GNU/Hurd....Ludovic Courtès 2018-12-03Merge branch 'core-updates'Ludovic Courtès 2018-12-02guile-json: Download source from savannah....Eric Bavier 2018-11-29gnu: haunt: Update to 0.2.4....David Thompson 2018-11-29Merge branch 'master' into core-updatesMarius Bakke 2018-11-27gnu: guile-simple-zmq: Update to 68bedb6....Ludovic Courtès 2018-11-20Merge branch 'master' into core-updatesMarius Bakke 2018-11-16guile: newt: Update revision to 2....Mathieu Othacehe 2018-11-14Merge branch 'master' into core-updatesMarius Bakke 2018-11-11gnu: guildhall: Remove custom bootstrap phase....Ricardo Wurmus 2018-11-11gnu: guile-dsv: Remove custom bootstrap phase....Ricardo Wurmus 2018-11-10gnu: Add guile-debbugs-next....Ricardo Wurmus 2018-11-10gnu: Add guile-email....Ricardo Wurmus 2018-11-10gnu: guile-ics: Remove custom bootstrap phase....Ricardo Wurmus 2018-11-09Merge branch 'master' into core-updatesMarius Bakke 2018-11-09gnu: guile-newt: Update to revision 1....Mathieu Othacehe 2018-11-07Merge branch 'master' into core-updatesMarius Bakke 2018-11-07gnu: Add guile-newt....Mathieu Othacehe 2018-11-06gnu: guile-sqlite3: Update home page....Ludovic Courtès 2018-10-19gnu: guile-commonmark: Update to 0.1.1....Ludovic Courtès 2018-10-17Merge branch 'master' into core-updatesMarius Bakke 2018-10-16gnu: Add guix-minimal....Eric Bavier 2018-10-16gnu: guile2.0-guix: Fix build....Eric Bavier 2018-10-10gnu: guile-next: Update to 2.9.1....Ludovic Courtès 2018-10-10gnu: haunt: Make sure Guile-CommonMark and Guile-Reader are always visible....Ludovic Courtès 2018-10-05Merge branch 'master' into core-updatesMarius Bakke 2018-10-04gnu: guile-next: Update to commit 6f3357b0df64c4be17e72079864c09a542f1c779....David Thompson 2018-10-04gnu: guile-next: Add the correct native search paths....David Thompson