mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
pull: Install (guix config) module to override the user's one.
* build-aux/build-self.scm (zlib, gzip, bzip2, xz): New variables. (build)[storedir, localstatedir, sysconfdir, sbindir]: New variables. [builder]: Pass them to 'build-guix'. * guix/build/pull.scm (build-guix): Add #:system, #:storedir, #:localstatedir, #:sysconfdir, #:sbindir, #:package-name, #:package-version, #:bug-report-address, #:home-page-url, #:libgcrypt, #:zlib, #:gzip, #:bzip2, and #:xz. Remove #:gcrypt. Instantiate all the substitution variables in (guix config). Remove code to delete OUT/guix/config.{scm,go}. * guix/config.scm.in: Add note about (guix script pull).
This commit is contained in:
parent
0b0086e94c
commit
13cee334f1
3 changed files with 76 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2014, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
(define-module (build-self)
|
(define-module (build-self)
|
||||||
#:use-module (gnu)
|
#:use-module (gnu)
|
||||||
#:use-module (guix)
|
#:use-module (guix)
|
||||||
|
#:use-module (guix config)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:export (build))
|
#:export (build))
|
||||||
|
|
||||||
|
@ -44,6 +45,18 @@ (define-module (build-self)
|
||||||
(define libgcrypt
|
(define libgcrypt
|
||||||
(first (find-best-packages-by-name "libgcrypt" #f)))
|
(first (find-best-packages-by-name "libgcrypt" #f)))
|
||||||
|
|
||||||
|
(define zlib
|
||||||
|
(first (find-best-packages-by-name "zlib" #f)))
|
||||||
|
|
||||||
|
(define gzip
|
||||||
|
(first (find-best-packages-by-name "gzip" #f)))
|
||||||
|
|
||||||
|
(define bzip2
|
||||||
|
(first (find-best-packages-by-name "bzip2" #f)))
|
||||||
|
|
||||||
|
(define xz
|
||||||
|
(first (find-best-packages-by-name "xz" #f)))
|
||||||
|
|
||||||
(define guile-json
|
(define guile-json
|
||||||
(first (find-best-packages-by-name "guile-json" #f)))
|
(first (find-best-packages-by-name "guile-json" #f)))
|
||||||
|
|
||||||
|
@ -63,6 +76,19 @@ (define* (build source #:key verbose?
|
||||||
#:rest rest)
|
#:rest rest)
|
||||||
"Return a derivation that unpacks SOURCE into STORE and compiles Scheme
|
"Return a derivation that unpacks SOURCE into STORE and compiles Scheme
|
||||||
files."
|
files."
|
||||||
|
;; The '%xxxdir' variables were added to (guix config) in July 2016 so we
|
||||||
|
;; cannot assume that they are defined. Try to guess their value when
|
||||||
|
;; they're undefined (XXX: we get an incorrect guess when environment
|
||||||
|
;; variables such as 'NIX_STATE_DIR' are defined!).
|
||||||
|
(define storedir
|
||||||
|
(if (defined? '%storedir) %storedir %store-directory))
|
||||||
|
(define localstatedir
|
||||||
|
(if (defined? '%localstatedir) %localstatedir (dirname %state-directory)))
|
||||||
|
(define sysconfdir
|
||||||
|
(if (defined? '%sysconfdir) %sysconfdir (dirname %config-directory)))
|
||||||
|
(define sbindir
|
||||||
|
(if (defined? '%sbindir) %sbindir (dirname %guix-register-program)))
|
||||||
|
|
||||||
(define builder
|
(define builder
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (guix build pull))
|
(use-modules (guix build pull))
|
||||||
|
@ -73,12 +99,28 @@ (define builder
|
||||||
|
|
||||||
(build-guix #$output #$source
|
(build-guix #$output #$source
|
||||||
|
|
||||||
|
#:system #$%system
|
||||||
|
#:storedir #$storedir
|
||||||
|
#:localstatedir #$localstatedir
|
||||||
|
#:sysconfdir #$sysconfdir
|
||||||
|
#:sbindir #$sbindir
|
||||||
|
|
||||||
|
#:package-name #$%guix-package-name
|
||||||
|
#:package-version #$%guix-version
|
||||||
|
#:bug-report-address #$%guix-bug-report-address
|
||||||
|
#:home-page-url #$%guix-home-page-url
|
||||||
|
|
||||||
|
#:libgcrypt #$libgcrypt
|
||||||
|
#:zlib #$zlib
|
||||||
|
#:gzip #$gzip
|
||||||
|
#:bzip2 #$bzip2
|
||||||
|
#:xz #$xz
|
||||||
|
|
||||||
;; XXX: This is not perfect, enabling VERBOSE? means
|
;; XXX: This is not perfect, enabling VERBOSE? means
|
||||||
;; building a different derivation.
|
;; building a different derivation.
|
||||||
#:debug-port (if #$verbose?
|
#:debug-port (if #$verbose?
|
||||||
(current-error-port)
|
(current-error-port)
|
||||||
(%make-void-port "w"))
|
(%make-void-port "w")))))
|
||||||
#:gcrypt #$libgcrypt)))
|
|
||||||
|
|
||||||
(gexp->derivation "guix-latest" builder
|
(gexp->derivation "guix-latest" builder
|
||||||
#:modules '((guix build pull)
|
#:modules '((guix build pull)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
|
;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -36,7 +36,17 @@ (define-module (guix build pull)
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(define* (build-guix out source
|
(define* (build-guix out source
|
||||||
#:key gcrypt
|
#:key
|
||||||
|
system
|
||||||
|
storedir localstatedir sysconfdir sbindir
|
||||||
|
|
||||||
|
(package-name "GNU Guix")
|
||||||
|
(package-version "0")
|
||||||
|
(bug-report-address "bug-guix@gnu.org")
|
||||||
|
(home-page-url "https://gnu.org/s/guix")
|
||||||
|
|
||||||
|
libgcrypt zlib gzip bzip2 xz
|
||||||
|
|
||||||
(debug-port (%make-void-port "w"))
|
(debug-port (%make-void-port "w"))
|
||||||
(log-port (current-error-port)))
|
(log-port (current-error-port)))
|
||||||
"Build and install Guix in directory OUT using SOURCE, a directory
|
"Build and install Guix in directory OUT using SOURCE, a directory
|
||||||
|
@ -55,13 +65,26 @@ (define* (build-guix out source
|
||||||
(copy-file "guix.scm" (string-append out "/guix.scm"))
|
(copy-file "guix.scm" (string-append out "/guix.scm"))
|
||||||
(copy-file "gnu.scm" (string-append out "/gnu.scm"))
|
(copy-file "gnu.scm" (string-append out "/gnu.scm"))
|
||||||
|
|
||||||
;; Add a fake (guix config) module to allow the other modules to be
|
;; Instantiate a (guix config) module that preserves the original
|
||||||
;; compiled. The user's (guix config) is the one that will be used.
|
;; settings.
|
||||||
(copy-file "guix/config.scm.in"
|
(copy-file "guix/config.scm.in"
|
||||||
(string-append out "/guix/config.scm"))
|
(string-append out "/guix/config.scm"))
|
||||||
(substitute* (string-append out "/guix/config.scm")
|
(substitute* (string-append out "/guix/config.scm")
|
||||||
(("@LIBGCRYPT@")
|
(("@PACKAGE_NAME@") package-name)
|
||||||
(string-append gcrypt "/lib/libgcrypt")))
|
(("@PACKAGE_VERSION@") package-version)
|
||||||
|
(("@PACKAGE_BUGREPORT@") bug-report-address)
|
||||||
|
(("@PACKAGE_URL@") home-page-url)
|
||||||
|
(("@storedir@") storedir)
|
||||||
|
(("@guix_localstatedir@") localstatedir)
|
||||||
|
(("@guix_sysconfdir@") sysconfdir)
|
||||||
|
(("@guix_sbindir@") sbindir)
|
||||||
|
(("@guix_system@") system)
|
||||||
|
(("@LIBGCRYPT@") (string-append libgcrypt "/lib/libgcrypt"))
|
||||||
|
(("@LIBZ@") (string-append zlib "/lib/libz"))
|
||||||
|
(("@GZIP@") (string-append gzip "/bin/gzip"))
|
||||||
|
(("@BZIP2@") (string-append bzip2 "/bin/bzip2"))
|
||||||
|
(("@XZ@") (string-append xz "/bin/xz"))
|
||||||
|
(("@NIX_INSTANTIATE@") "")) ;remnants from the past
|
||||||
|
|
||||||
;; Augment the search path so Scheme code can be compiled.
|
;; Augment the search path so Scheme code can be compiled.
|
||||||
(set! %load-path (cons out %load-path))
|
(set! %load-path (cons out %load-path))
|
||||||
|
@ -119,10 +142,6 @@ (define* (build-guix out source
|
||||||
(set! completed (+ 1 completed))))
|
(set! completed (+ 1 completed))))
|
||||||
files))))
|
files))))
|
||||||
|
|
||||||
;; Remove the "fake" (guix config).
|
|
||||||
(delete-file (string-append out "/guix/config.scm"))
|
|
||||||
(delete-file (string-append out "/guix/config.go"))
|
|
||||||
|
|
||||||
(newline)
|
(newline)
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,8 @@ (define-module (guix config)
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;;
|
;;;
|
||||||
;;; Compile-time configuration of Guix.
|
;;; Compile-time configuration of Guix. When adding a substitution variable
|
||||||
|
;;; here, make sure to equip (guix scripts pull) to substitute it.
|
||||||
;;;
|
;;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue