From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiRCn-00075B-Fd for guix-patches@gnu.org; Sun, 04 Feb 2018 15:48:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eiRCk-0007oC-Bo for guix-patches@gnu.org; Sun, 04 Feb 2018 15:48:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:49475) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eiRCk-0007o4-5Y for guix-patches@gnu.org; Sun, 04 Feb 2018 15:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eiRCj-0001QI-RC for guix-patches@gnu.org; Sun, 04 Feb 2018 15:48:01 -0500 Subject: [bug#30351] [PATCH] gnu: mcron2: Correct and enhance the wrap phase. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiRCR-0006wj-1l for guix-patches@gnu.org; Sun, 04 Feb 2018 15:47:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eiRCN-0007h8-VT for guix-patches@gnu.org; Sun, 04 Feb 2018 15:47:43 -0500 Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]:38057) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eiRCN-0007gs-N5 for guix-patches@gnu.org; Sun, 04 Feb 2018 15:47:39 -0500 Received: by mail-it0-x235.google.com with SMTP id k6so13620272ita.3 for ; Sun, 04 Feb 2018 12:47:39 -0800 (PST) Received: from apteryx ([45.72.232.234]) by smtp.gmail.com with ESMTPSA id j30sm4183317ioi.55.2018.02.04.12.47.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Feb 2018 12:47:37 -0800 (PST) From: Maxim Cournoyer Date: Sun, 04 Feb 2018 15:47:36 -0500 Message-ID: <874lmwwkgn.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30351@debbugs.gnu.org --=-=-= Content-Type: text/plain Hello! As a follow up to my previous patch to mcron2, this completes the wrap phases and fix a small issue where the mcron modules were installed to share/guile/site/2.0 instead of 2.2. For those using dyndns services, a job like the following should now work without having to propagate Guile or GnuTLS in your user/system profile[0]: --8<---------------cut here---------------start------------->8--- ;;; Secrets defined as variables prefixed by "sec-". (include "/abs/path/to/your/secrets.scm") (define duckdns-job ;; Update personal domain IP every 5 minutes. #~(job '(next-minute (range 0 60 5)) (lambda () (use-modules (web client)) (http-get (string-append "https://www.duckdns.org/update?domains=apteryx&token=" #$sec-dyndns-token "&ip="))))) (operating-system ... (services (cons* (mcron-service (list duckdns-job)) ... --8<---------------cut here---------------end--------------->8--- I had tested my previous patch as a user (where Guile and GnuTLS were installed), so it was working, but after testing from the "real" herd service (which runs as root), it was failing, not finding the (web client) and GnuTLS modules. The attached patch fixes that. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gnu-mcron2-Correct-and-enhance-the-wrap-phase.patch >From 385343b1370d87e6104ebe2ef473bf2d1e31f2f2 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 4 Feb 2018 14:05:40 -0500 Subject: [PATCH] gnu: mcron2: Correct and enhance the wrap phase. * gnu/packages/guile.scm (mcron2)[inputs]: Rename "guile-2.2" to just "guile". [phases]: Install mcron2 modules to guile/site/2.2 instead of guile/site/2.0. Add Guile 2.2 and GnuTLS modules to the wrap phase. --- gnu/packages/guile.scm | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 3bc18ffdd..37e6703fa 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -64,6 +64,7 @@ #:use-module (gnu packages sdl) #:use-module (gnu packages maths) #:use-module (gnu packages image) + #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg) @@ -632,7 +633,8 @@ format is also supported.") ("texinfo" ,texinfo) ("help2man" ,help2man))) (inputs - `(("guile-2.2" ,guile-2.2) + `(("guile" ,guile-2.2) + ("gnutls" ,gnutls) ;for the wrap-mcron phase ,@(srfi-1:alist-delete "guile" (package-inputs mcron)))) (arguments `(#:modules ((ice-9 match) (ice-9 ftw) @@ -645,6 +647,7 @@ format is also supported.") (add-after 'unpack 'use-guile-2.2 (lambda _ (substitute* "configure.ac" + (("guile/site/2.0") "guile/site/2.2") (("PKG_CHECK_MODULES\\(\\[GUILE\\],.*$") "PKG_CHECK_MODULES([GUILE], [guile-2.2])\n")) #t)) @@ -652,22 +655,28 @@ format is also supported.") (lambda _ (invoke "autoreconf" "-vfi"))) (add-after 'install 'wrap-mcron - (lambda* (#:key outputs #:allow-other-keys) - ;; Wrap the 'mcron' command to refer to the right - ;; modules. - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin")) - (site (string-append - out "/share/guile/site"))) - (match (scandir site) - (("." ".." version) - (let ((modules (string-append site "/" version))) - (wrap-program (string-append bin "/mcron") - `("GUILE_LOAD_PATH" ":" prefix - (,modules)) - `("GUILE_LOAD_COMPILED_PATH" ":" prefix - (,modules))) - #t)))))))))))) + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Wrap the 'mcron' command to refer to the right modules. We + ;; also include Guile 2.2 modules and GnuTLS, so that Guile + ;; libraries can be used in mcron jobs without having to + ;; propagate those in a user profile. + (let* ((site-dir "/share/guile/site/2.2") + (ccache-dir "/lib/guile/2.2/ccache") + (mcron (assoc-ref outputs "out")) + (mcron-bin (string-append mcron "/bin/mcron")) + (mcron-modules (string-append mcron site-dir)) + (guile (assoc-ref inputs "guile")) + (guile-modules (string-append guile site-dir)) + (guile-ccache (string-append guile ccache-dir)) + (gnutls (assoc-ref inputs "gnutls")) + (gnutls-modules (string-append gnutls site-dir)) + (gnutls-ccache (string-append gnutls ccache-dir))) + (wrap-program mcron-bin + `("GUILE_LOAD_PATH" ":" prefix + (,mcron-modules ,guile-modules ,gnutls-modules)) + `("GUILE_LOAD_COMPILED_PATH" ":" prefix + (,mcron-modules ,guile-ccache ,gnutls-ccache))) + #t))))))))) (define-public guile-ics (package -- 2.16.0 --=-=-= Content-Type: text/plain Thank you, Maxim [0] A note of caution: secrets managed that way are not that secret: they are visible in the derived job script (world readable under /gnu/store). You might want to prefer keeping your mcron jobs in your $HOME for better security. --=-=-=--