git.iko.soy/typeable/nixpkgs
on master help sign in
Add optional IPv6 support for nix-binary-cache
d64160eMichael Raskin
pkgs/servers/http/nix-binary-cache/nix-binary-cache-start.in+12
@@ -39,6 +39,10 @@ parse_opts () {
39 echo "PORT=$1"
39 echo "PORT=$1"
40 shift;
40 shift;
41 ;;
41 ;;
42+ --ipv6)
43+ shift;
44+ echo "USE_IPV6=enable"
45+ ;;
42 --help)
46 --help)
43 cat <<EOF >&2
47 cat <<EOF >&2
44"$0": start the Nix binary cache serving the Nix store dynamically.
48"$0": start the Nix binary cache serving the Nix store dynamically.
@@ -57,6 +61,8 @@ Recognized options:
57--nix-remote 'daemon' or empty string '' - whether to use daemon for store
61--nix-remote 'daemon' or empty string '' - whether to use daemon for store
58 operations
62 operations
59
63
64+--ipv6 enable ipv6
65+
60--help show help and exit
66--help show help and exit
61EOF
67EOF
62 exit 1;
68 exit 1;
@@ -82,6 +88,12 @@ cgi.assign = ( \".cgi\" => \"@shell@\" )
82setenv.add-request-header = ( \"NIX_BINARY_CACHE_CONFIG\" => \"$workingdir/nix-binary-cache.conf\" )
88setenv.add-request-header = ( \"NIX_BINARY_CACHE_CONFIG\" => \"$workingdir/nix-binary-cache.conf\" )
83" > lighttpd.conf
89" > lighttpd.conf
84
90
91+test -n "$USE_IPV6" && echo "
92+\$SERVER[\"socket\"] == \"[::]:$PORT\" {
93+server.use-ipv6 = \"enable\"
94+}
95+" >> lighttpd.conf
96+
85cp @out@/nix-binary-cache.cgi .
97cp @out@/nix-binary-cache.cgi .
86cp @out@/nix-binary-cache.cgi ./nix-bc.cgi
98cp @out@/nix-binary-cache.cgi ./nix-bc.cgi
87
99