diff options
author | Marius Bakke <mbakke@fastmail.com> | 2020-05-08 21:40:51 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2020-05-08 21:40:51 +0200 |
commit | 4bdf4182fe080c3409f6ef9b410146b67cfa2595 (patch) | |
tree | f1123ddb8c57eda6de026982904f6c5309adaca6 /gnu/services/shepherd.scm | |
parent | c81457a5883ea43950eb2ecdcbb58a5b144bcd11 (diff) | |
parent | 23a59b180b28b9fa22120c2b8305b9324442b94d (diff) |
Merge branch 'core-updates'
Diffstat (limited to 'gnu/services/shepherd.scm')
-rw-r--r-- | gnu/services/shepherd.scm | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index ecdf2f242e..826a3c2215 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au> +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ #:use-module (guix store) #:use-module (guix records) #:use-module (guix derivations) ;imported-modules, etc. + #:use-module (guix utils) #:use-module (gnu services) #:use-module (gnu services herd) #:use-module (gnu packages admin) @@ -264,22 +266,27 @@ stored." (define (scm->go file) "Compile FILE, which contains code to be loaded by shepherd's config file, and return the resulting '.go' file." - (with-extensions (list shepherd) - (computed-file (string-append (basename (scheme-file-name file) ".scm") - ".go") - #~(begin - (use-modules (system base compile)) - - ;; Do the same as the Shepherd's 'load-in-user-module'. - (let ((env (make-fresh-user-module))) - (module-use! env (resolve-interface '(oop goops))) - (module-use! env (resolve-interface '(shepherd service))) - (compile-file #$file #:output-file #$output - #:env env))) - - ;; It's faster to build locally than to download. - #:options '(#:local-build? #t - #:substitutable? #f)))) + ;; FIXME: %current-target-system may not be bound <https://bugs.gnu.org/29296> + (let ((target (%current-target-system))) + (with-extensions (list shepherd) + (computed-file (string-append (basename (scheme-file-name file) ".scm") + ".go") + #~(begin + (use-modules (system base compile) + (system base target)) + + ;; Do the same as the Shepherd's 'load-in-user-module'. + (let ((env (make-fresh-user-module))) + (module-use! env (resolve-interface '(oop goops))) + (module-use! env (resolve-interface '(shepherd service))) + (with-target #$(or target #~%host-type) + (lambda _ + (compile-file #$file #:output-file #$output + #:env env))))) + + ;; It's faster to build locally than to download. + #:options '(#:local-build? #t + #:substitutable? #f))))) (define (shepherd-configuration-file services) "Return the shepherd configuration file for SERVICES." |