From: Leo Famulari <leo@famulari.name>
To: Mathieu Lirzin <mthl@gnu.org>
Cc: 25831@debbugs.gnu.org
Subject: bug#25831: Expose http_proxy setting on GuixSD
Date: Tue, 21 Feb 2017 15:26:54 -0500 [thread overview]
Message-ID: <20170221202654.GA16281@jasmine> (raw)
In-Reply-To: <87efyrwgrk.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 789 bytes --]
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 daemon
> service field like described in the example here:
>
> https://www.gnu.org/software/guix/manual/html_node/Using-the-Configuration-System.html#System-Services
>
> 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.
[-- Attachment #2: 0001-services-guix-Support-using-an-HTTP-proxy.patch --]
[-- Type: text/plain, Size: 3025 bytes --]
From 1e6e95ea5b43231d09279b9e54f5c581462486f6 Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Tue, 21 Feb 2017 14:57:02 -0500
Subject: [PATCH] services: guix: Support using an HTTP proxy.
* gnu/services/base.scm (<guix-configuration>)[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.
+@item @code{http-proxy} (default: @code{#f})
+The HTTP proxy used for downloading fixed-output derivations and
+substitutes.
+
@end table
@end deftp
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 © 2015, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;;
@@ -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 ;<package>
- (default lsof)))
+ (default lsof))
+ (http-proxy guix-http-proxy ;string
+ (default #f)))
(define %default-guix-configuration
(guix-configuration))
@@ -1125,7 +1127,7 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
(($ <guix-configuration> guix build-group build-accounts
authorize-key? keys
use-substitutes? substitute-urls extra-options
- 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))))))))
;; Add 'lsof' (for the GC) to the daemon's $PATH.
#:environment-variables
- (list (string-append "PATH=" #$lsof "/bin"))
+ (list (string-append "PATH=" #$lsof "/bin")
+ #$@(if http-proxy
+ #~((string-append"http_proxy=" #$http-proxy))
+ #~()))
#:log-file #$log-file))
(stop #~(make-kill-destructor)))))))
--
2.11.1
[-- Attachment #3: os-config-bare-bones.scm --]
[-- Type: text/plain, Size: 1895 bytes --]
;; This is an operating system configuration template
;; for a "bare bones" setup, with no X11 display server.
(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules admin)
(operating-system
(host-name "komputilo")
(timezone "Europe/Berlin")
(locale "en_US.utf8")
;; Assuming /dev/sdX is the target hard disk, and "my-root" is
;; the label of the target root file system.
(bootloader (grub-configuration (device "/dev/sdX")))
(file-systems (cons (file-system
(device "my-root")
(title 'label)
(mount-point "/")
(type "ext4"))
%base-file-systems))
;; This is where user accounts are specified. The "root"
;; account is implicit, and is initially created with the
;; empty password.
(users (cons (user-account
(name "alice")
(comment "Bob's sister")
(group "users")
;; Adding the account to the "wheel" group
;; makes it a sudoer. Adding it to "audio"
;; and "video" allows the user to play sound
;; and access the webcam.
(supplementary-groups '("wheel"
"audio" "video"))
(home-directory "/home/alice"))
%base-user-accounts))
;; Globally-installed packages.
(packages (cons* tcpdump htop %base-packages))
;; Add services to the baseline: a DHCP client and
;; an SSH server.
(services (cons* (dhcp-client-service)
(modify-services %base-services
(guix-service-type config =>
(guix-configuration
(inherit config)
(http-proxy "http://example.com")))))))
next prev parent reply other threads:[~2017-02-21 20:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 17:19 bug#25831: Expose http_proxy setting on GuixSD Leo Famulari
2017-02-21 18:17 ` Mathieu Lirzin
2017-02-21 20:26 ` Leo Famulari [this message]
2017-02-22 9:51 ` Mathieu Lirzin
2017-02-22 19:22 ` Leo Famulari
2017-02-22 20:15 ` Mathieu Lirzin
2017-02-22 20:26 ` Leo Famulari
2017-02-23 16:20 ` ng0
2017-02-23 17:05 ` Leo Famulari
2017-02-23 17:50 ` ng0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170221202654.GA16281@jasmine \
--to=leo@famulari.name \
--cc=25831@debbugs.gnu.org \
--cc=mthl@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.