diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-02-12 18:59:11 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-02-12 21:54:25 +0100 |
commit | 98a7b528d61cfca3f8bfc827cf94f4716ab75abd (patch) | |
tree | 0f6b1d8c8eaf02d2ad6eca3d8ba673e57fc648be /guix/store.scm | |
parent | 0d0bcaa08e8473693dab01ebf417b9e9fcefa087 (diff) | |
download | gnu-guix-98a7b528d61cfca3f8bfc827cf94f4716ab75abd.tar gnu-guix-98a7b528d61cfca3f8bfc827cf94f4716ab75abd.tar.gz |
store: Add monadic access to '%current-system'.
* guix/store.scm (current-system, set-current-system): New procedures.
* tests/store.scm ("current-system"): New test.
Diffstat (limited to 'guix/store.scm')
-rw-r--r-- | guix/store.scm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/guix/store.scm b/guix/store.scm index 3c4d1c0058..8123407816 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -118,6 +118,8 @@ store-lower run-with-store %guile-for-build + current-system + set-current-system text-file interned-file @@ -1040,6 +1042,18 @@ permission bits are kept." (define set-build-options* (store-lift set-build-options)) +(define-inlinable (current-system) + ;; Consult the %CURRENT-SYSTEM fluid at bind time. This is equivalent to + ;; (lift0 %current-system %store-monad), but inlinable, thus avoiding + ;; closure allocation in some cases. + (lambda (state) + (values (%current-system) state))) + +(define-inlinable (set-current-system system) + ;; Set the %CURRENT-SYSTEM fluid at bind time. + (lambda (state) + (values (%current-system system) state))) + (define %guile-for-build ;; The derivation of the Guile to be used within the build environment, ;; when using 'gexp->derivation' and co. |