~ruther/guix-local

d8eea3d2bce9c9e834210237090947de4600cfe8 — Ludovic Courtès 13 years ago 69cfce5
build: Capture configure-time settings in (guix config).

* configure.ac: Compute and substitute `guix_localstatedir'.
* m4/guix.m4: Substitute `guix_system'.
* guix/config.scm.in (%store-directory, %store-directory, %system): New
  variables.
* guix/store.scm (%nix-state-dir): Remove.
  (%default-socket-path): Use %STATE-DIRECTORY as the default.
  (%store-prefix): Use %STORE-DIRECTORY as the default.
* guix/utils.scm (%current-system): Default to %SYSTEM.
5 files changed, 24 insertions(+), 5 deletions(-)

M configure.ac
M guix/config.scm.in
M guix/store.scm
M guix/utils.scm
M m4/guix.m4
M configure.ac => configure.ac +5 -0
@@ 30,6 30,11 @@ AC_ARG_WITH(store-dir,
  [storedir="/nix/store"])
AC_SUBST(storedir)

# Prepare a version of $localstatedir that does not contain references
# to shell variables.
guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|/usr/local|g"`"
AC_SUBST([guix_localstatedir])

PKG_CHECK_MODULES([GUILE], [guile-2.0])
AC_PATH_PROG([GUILE], [guile])
AC_PATH_PROG([GUILD], [guild])

M guix/config.scm.in => guix/config.scm.in +12 -0
@@ 20,6 20,9 @@
  #:export (%guix-package-name
            %guix-version
            %guix-bug-report-address
            %store-directory
            %state-directory
            %system
            %libgcrypt
            %nixpkgs
            %nix-instantiate))


@@ 39,6 42,15 @@
(define %guix-bug-report-address
  "@PACKAGE_BUGREPORT@")

(define %store-directory
  "@storedir@")

(define %state-directory
  "@guix_localstatedir@")

(define %system
  "@guix_system@")

(define %libgcrypt
  "@LIBGCRYPT@")


M guix/store.scm => guix/store.scm +4 -4
@@ 18,6 18,7 @@

(define-module (guix store)
  #:use-module (guix utils)
  #:use-module (guix config)
  #:use-module (rnrs bytevectors)
  #:use-module (rnrs io ports)
  #:use-module (srfi srfi-1)


@@ 111,10 112,9 @@
  (sha1 2)
  (sha256 3))

(define %nix-state-dir
  (or (getenv "NIX_STATE_DIR") "/nix/var/nix"))
(define %default-socket-path
  (string-append %nix-state-dir "/daemon-socket/socket"))
  (string-append (or (getenv "NIX_STATE_DIR") %state-directory)
                 "/daemon-socket/socket"))


;; serialize.cc


@@ 439,7 439,7 @@ file name.  Return #t on success."
(define %store-prefix
  ;; Absolute path to the Nix store.
  (make-parameter (or (and=> (getenv "NIX_STORE_DIR") canonicalize-path)
                      "/nix/store")))
                      %store-directory)))

(define (store-path? path)
  "Return #t if PATH is a store path."

M guix/utils.scm => guix/utils.scm +2 -1
@@ 342,7 342,8 @@ returned by `config.guess'."

(define %current-system
  ;; System type as expected by Nix, usually ARCHITECTURE-KERNEL.
  (make-parameter (gnu-triplet->nix-system %host-type)))
  ;; By default, this is equal to (gnu-triplet->nix-system %host-type).
  (make-parameter %system))

(define (package-name->name+version name)
  "Given NAME, a package name like \"foo-0.9.1b\", return two values:

M m4/guix.m4 => m4/guix.m4 +1 -0
@@ 61,4 61,5 @@ AC_DEFUN([GUIX_SYSTEM_TYPE], [
	  # `darwin10.2.0', etc.
	  guix_system="$machine_name-`echo $host_os | "$SED" -e's/@<:@0-9.@:>@*$//g'`";;
     esac])
  AC_SUBST([guix_system])
])