From 80d0447c9556f06decc80a2d43c2fa8402406d91 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 8 Jan 2014 21:12:55 +0100 Subject: config: '%state-directory' always honors $NIX_STATE_DIR. * guix/config.scm.in (%state-directory): Honor $NIX_STATE_DIR. * guix/scripts/package.scm (%profile-directory): Use %state-directory directly. * guix/store.scm (%default-socket-path, log-file): Likewise. --- guix/config.scm.in | 4 ++-- guix/scripts/package.scm | 2 +- guix/store.scm | 8 ++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/guix/config.scm.in b/guix/config.scm.in index 4835c6e5d9..0833faef40 100644 --- a/guix/config.scm.in +++ b/guix/config.scm.in @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -55,7 +55,7 @@ (define %state-directory ;; This must match `NIX_STATE_DIR' as defined in `daemon.am'. - "@guix_localstatedir@/nix") + (or (getenv "NIX_STATE_DIR") "@guix_localstatedir@/nix")) (define %config-directory ;; This must match `NIX_CONF_DIR' as defined in `daemon.am'. diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index c12ddcd8c9..04393abc9a 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -57,7 +57,7 @@ (cut string-append <> "/.guix-profile"))) (define %profile-directory - (string-append (or (getenv "NIX_STATE_DIR") %state-directory) "/profiles/" + (string-append %state-directory "/profiles/" (or (and=> (getenv "USER") (cut string-append "per-user/" <>)) "default"))) diff --git a/guix/store.scm b/guix/store.scm index 159b5dc396..7715a15644 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -158,8 +158,7 @@ (delete-specific 3)) (define %default-socket-path - (string-append (or (getenv "NIX_STATE_DIR") %state-directory) - "/daemon-socket/socket")) + (string-append %state-directory "/daemon-socket/socket")) (define %daemon-socket-file ;; File name of the socket the daemon listens too. @@ -749,12 +748,9 @@ syntactically valid store path." (define (log-file store file) "Return the build log file for FILE, or #f if none could be found. FILE must be an absolute store file name, or a derivation file name." - (define state-dir ; XXX: factorize - (or (getenv "NIX_STATE_DIR") %state-directory)) - (cond ((derivation-path? file) (let* ((base (basename file)) - (log (string-append (dirname state-dir) ; XXX: ditto + (log (string-append (dirname %state-directory) ; XXX "/log/nix/drvs/" (string-take base 2) "/" (string-drop base 2))) -- cgit v1.2.3