mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
services: shepherd: Cross-compilation fix.
Fixes <https://bugs.gnu.org/40839>. Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org> Fix suggested by Mathieu Othacehe <m.othacehe@gmail.com> However, <https://bugs.gnu.org/29296> still applies; %current-target-system may not be bound. * gnu/services/shepherd.scm (scm->go): Use `with-target' when cross-compiling.
This commit is contained in:
parent
6ac6c1d28d
commit
d2fc76462e
1 changed files with 21 additions and 14 deletions
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
|
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
|
||||||
;;; Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
|
;;; Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
|
||||||
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -25,6 +26,7 @@ (define-module (gnu services shepherd)
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix derivations) ;imported-modules, etc.
|
#:use-module (guix derivations) ;imported-modules, etc.
|
||||||
|
#:use-module (guix utils)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services herd)
|
#:use-module (gnu services herd)
|
||||||
#:use-module (gnu packages admin)
|
#:use-module (gnu packages admin)
|
||||||
|
@ -260,22 +262,27 @@ (define (shepherd-service-file service)
|
||||||
(define (scm->go file)
|
(define (scm->go file)
|
||||||
"Compile FILE, which contains code to be loaded by shepherd's config file,
|
"Compile FILE, which contains code to be loaded by shepherd's config file,
|
||||||
and return the resulting '.go' file."
|
and return the resulting '.go' file."
|
||||||
|
;; FIXME: %current-target-system may not be bound <https://bugs.gnu.org/29296>
|
||||||
|
(let ((target (%current-target-system)))
|
||||||
(with-extensions (list shepherd)
|
(with-extensions (list shepherd)
|
||||||
(computed-file (string-append (basename (scheme-file-name file) ".scm")
|
(computed-file (string-append (basename (scheme-file-name file) ".scm")
|
||||||
".go")
|
".go")
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (system base compile))
|
(use-modules (system base compile)
|
||||||
|
(system base target))
|
||||||
|
|
||||||
;; Do the same as the Shepherd's 'load-in-user-module'.
|
;; Do the same as the Shepherd's 'load-in-user-module'.
|
||||||
(let ((env (make-fresh-user-module)))
|
(let ((env (make-fresh-user-module)))
|
||||||
(module-use! env (resolve-interface '(oop goops)))
|
(module-use! env (resolve-interface '(oop goops)))
|
||||||
(module-use! env (resolve-interface '(shepherd service)))
|
(module-use! env (resolve-interface '(shepherd service)))
|
||||||
|
(with-target #$(or target #~%host-type)
|
||||||
|
(lambda _
|
||||||
(compile-file #$file #:output-file #$output
|
(compile-file #$file #:output-file #$output
|
||||||
#:env env)))
|
#:env env)))))
|
||||||
|
|
||||||
;; It's faster to build locally than to download.
|
;; It's faster to build locally than to download.
|
||||||
#:options '(#:local-build? #t
|
#:options '(#:local-build? #t
|
||||||
#:substitutable? #f))))
|
#:substitutable? #f)))))
|
||||||
|
|
||||||
(define (shepherd-configuration-file services)
|
(define (shepherd-configuration-file services)
|
||||||
"Return the shepherd configuration file for SERVICES."
|
"Return the shepherd configuration file for SERVICES."
|
||||||
|
|
Loading…
Reference in a new issue