summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2015-01-03 03:03:29 +0300
committerMichael Raskin <7c6f434c@mail.ru>2015-01-03 03:05:26 +0300
commitd64160ec996d922234462f88a72b043a7b19ec85 (patch)
tree7b5a0d5afc9b2e8c82e722f75f8364966321d498
parent4e7eb5c53812dc57337ee7f40f1e0aab8d0561b1 (diff)
downloadnixlib-d64160ec996d922234462f88a72b043a7b19ec85.tar
nixlib-d64160ec996d922234462f88a72b043a7b19ec85.tar.gz
nixlib-d64160ec996d922234462f88a72b043a7b19ec85.tar.bz2
nixlib-d64160ec996d922234462f88a72b043a7b19ec85.tar.lz
nixlib-d64160ec996d922234462f88a72b043a7b19ec85.tar.xz
nixlib-d64160ec996d922234462f88a72b043a7b19ec85.tar.zst
nixlib-d64160ec996d922234462f88a72b043a7b19ec85.zip
Add optional IPv6 support for nix-binary-cache
-rw-r--r--pkgs/servers/http/nix-binary-cache/nix-binary-cache-start.in12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/servers/http/nix-binary-cache/nix-binary-cache-start.in b/pkgs/servers/http/nix-binary-cache/nix-binary-cache-start.in
index 2a2356f39ab2..13b62a8829da 100644
--- a/pkgs/servers/http/nix-binary-cache/nix-binary-cache-start.in
+++ b/pkgs/servers/http/nix-binary-cache/nix-binary-cache-start.in
@@ -39,6 +39,10 @@ parse_opts () {
         echo "PORT=$1"
         shift;
         ;;
+      --ipv6)
+        shift;
+	echo "USE_IPV6=enable"
+	;;
       --help)
         cat <<EOF >&2
 "$0": start the Nix binary cache serving the Nix store dynamically.
@@ -57,6 +61,8 @@ Recognized options:
 --nix-remote     'daemon' or empty string '' - whether to use daemon for store
                    operations
 
+--ipv6           enable ipv6
+
 --help           show help and exit
 EOF
 	exit 1;
@@ -82,6 +88,12 @@ cgi.assign = ( \".cgi\" => \"@shell@\" )
 setenv.add-request-header = ( \"NIX_BINARY_CACHE_CONFIG\" => \"$workingdir/nix-binary-cache.conf\" )
 " > lighttpd.conf
 
+test -n "$USE_IPV6" && echo "
+\$SERVER[\"socket\"] == \"[::]:$PORT\" {
+server.use-ipv6 = \"enable\"
+}
+" >> lighttpd.conf
+
 cp @out@/nix-binary-cache.cgi . 
 cp @out@/nix-binary-cache.cgi ./nix-bc.cgi