From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: bug#25831: Expose http_proxy setting on GuixSD Date: Wed, 22 Feb 2017 10:51:47 +0100 Message-ID: <87r32qv9ho.fsf@gnu.org> References: <20170221171912.GB1656@jasmine> <87efyrwgrk.fsf@gnu.org> <20170221202654.GA16281@jasmine> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgTbb-0004L2-Mf for bug-guix@gnu.org; Wed, 22 Feb 2017 04:53:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgTba-0004op-6P for bug-guix@gnu.org; Wed, 22 Feb 2017 04:53:03 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:51432) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cgTba-0004ok-2M for bug-guix@gnu.org; Wed, 22 Feb 2017 04:53:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cgTbZ-0008SU-SG for bug-guix@gnu.org; Wed, 22 Feb 2017 04:53:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20170221202654.GA16281@jasmine> (Leo Famulari's message of "Tue, 21 Feb 2017 15:26:54 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Leo Famulari Cc: 25831@debbugs.gnu.org Hi, Leo Famulari writes: > On Tue, Feb 21, 2017 at 07:17:03PM +0100, Mathieu Lirzin wrote: >> Not sure if this is an appropriate answer, but to customize the guix dae= mon >> service field like described in the example here: >>=20 >> https://www.gnu.org/software/guix/manual/html_node/Using-the-Configura= tion-System.html#System-Services >>=20 >> you would have to patch "gnu/services/base.scm" by adding a field to the >> 'guix-configuration' that would be then be passed to the >> '#:environment-variables' option of 'make-forkexec-constructor' in >> 'guix-shepherd-service'. > > Thank you, that helped a lot! > > What do the two of you think of the attached patch? > > Using the attached OS declaration, I verified that the http_proxy > environment variable is set in the guix-daemon's environment, but I > don't have a proxy to test with. > > From 1e6e95ea5b43231d09279b9e54f5c581462486f6 Mon Sep 17 00:00:00 2001 > From: Leo Famulari > Date: Tue, 21 Feb 2017 14:57:02 -0500 > Subject: [PATCH] services: guix: Support using an HTTP proxy. > > * gnu/services/base.scm ()[http-proxy]: New field. > (guix-shepherd-service): Use 'http-proxy' in #:environment-variables. > * doc/guix.texi ... > --- > doc/guix.texi | 4 ++++ > gnu/services/base.scm | 13 +++++++++---- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 6cdb5e592..19a31c659 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -8611,6 +8611,10 @@ are written. > @item @code{lsof} (default: @var{lsof}) > The lsof package to use. >=20=20 > +@item @code{http-proxy} (default: @code{#f}) > +The HTTP proxy used for downloading fixed-output derivations and > +substitutes. > + I don't know much about HTTP proxying but when reading 'in-band-download' in "guix/download.scm" I see a line like this: #:leaked-env-vars '("http_proxy" "https_proxy") which makes me think that maybe we should add an https_proxy toggle in 'guix-configuration' too? However I see that 'open-connection-for-uri' in "guix/download.scm" ignores "https_proxy" with a comment from 2015: ;; For HTTPS URIs, honor 'https_proxy', not 'http_proxy'. ;; FIXME: Proxying is not supported for https. Do you have any idea if this could be easily fixed? > @end table > @end deftp >=20=20 > diff --git a/gnu/services/base.scm b/gnu/services/base.scm > index 57601eab8..352a90be7 100644 > --- a/gnu/services/base.scm > +++ b/gnu/services/base.scm > @@ -3,7 +3,7 @@ > ;;; Copyright =C2=A9 2015, 2016 Alex Kost > ;;; Copyright =C2=A9 2015, 2016 Mark H Weaver > ;;; Copyright =C2=A9 2015 Sou Bunnbu > -;;; Copyright =C2=A9 2016 Leo Famulari > +;;; Copyright =C2=A9 2016, 2017 Leo Famulari > ;;; Copyright =C2=A9 2016 David Craven > ;;; Copyright =C2=A9 2016 Ricardo Wurmus > ;;; > @@ -1114,7 +1114,9 @@ failed to register hydra.gnu.org public key: ~a~%" = status)))))))) > (log-file guix-configuration-log-file ;string > (default "/var/log/guix-daemon.log")) > (lsof guix-configuration-lsof ; > - (default lsof))) > + (default lsof)) > + (http-proxy guix-http-proxy ;string > + (default #f))) '#f' is not a string. So either specify ';string | #f' or make the default value '""'. >=20=20 > (define %default-guix-configuration > (guix-configuration)) > @@ -1125,7 +1127,7 @@ failed to register hydra.gnu.org public key: ~a~%" = status)))))))) > (($ guix build-group build-accounts > authorize-key? keys > use-substitutes? substitute-urls extra-opti= ons > - log-file lsof) > + log-file lsof http-proxy) > (list (shepherd-service > (documentation "Run the Guix daemon.") > (provision '(guix-daemon)) > @@ -1142,7 +1144,10 @@ failed to register hydra.gnu.org public key: ~a~%"= status)))))))) >=20=20 > ;; Add 'lsof' (for the GC) to the daemon's $PATH. > #:environment-variables > - (list (string-append "PATH=3D" #$lsof "/bin")) > + (list (string-append "PATH=3D" #$lsof "/bin") > + #$@(if http-proxy > + #~((string-append"http_proxy=3D" #$http-proxy= )) > + #~())) I think it would be more readable like this: #$@(if http-proxy (list (string-append "http_proxy=3D" http-proxy)) '()) or if '""' is the default value: #$@(if (string-null? http-proxy) '() (list (string-append "http_proxy=3D" http-proxy))) Thanks. --=20 Mathieu Lirzin GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37