Merge pull request #63135 from Ma27/captive-browser-regression

nixos/captive-browser: fix module
This commit is contained in:
Samuel Dionne-Riel 2019-06-14 21:29:26 -04:00 committed by GitHub
commit 8c14a6f641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,8 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.captive-browser; default = pkgs.captive-browser;
defaultText = "pkgs.captive-browser";
description = "Which package to use for captive-browser";
}; };
interface = mkOption { interface = mkOption {
@ -35,7 +37,7 @@ in
''http://cache.nixos.org/'' ''http://cache.nixos.org/''
]; ];
description = '' description = ''
the shell (/bin/sh) command executed once the proxy starts. The shell (/bin/sh) command executed once the proxy starts.
When browser exits, the proxy exits. An extra env var PROXY is available. When browser exits, the proxy exits. An extra env var PROXY is available.
Here, we use a separate Chrome instance in Incognito mode, so that Here, we use a separate Chrome instance in Incognito mode, so that
@ -51,7 +53,7 @@ in
dhcp-dns = mkOption { dhcp-dns = mkOption {
type = types.str; type = types.str;
description = '' description = ''
the shell (/bin/sh) command executed to obtain the DHCP The shell (/bin/sh) command executed to obtain the DHCP
DNS server address. The first match of an IPv4 regex is used. DNS server address. The first match of an IPv4 regex is used.
IPv4 only, because let's be real, it's a captive portal. IPv4 only, because let's be real, it's a captive portal.
''; '';
@ -62,6 +64,16 @@ in
default = "localhost:1666"; default = "localhost:1666";
description = ''the listen address for the SOCKS5 proxy server''; description = ''the listen address for the SOCKS5 proxy server'';
}; };
bindInterface = mkOption {
default = true;
type = types.bool;
description = ''
Binds <package>captive-browser</package> to the network interface declared in
<literal>cfg.interface</literal>. This can be used to avoid collisions
with private subnets.
'';
};
}; };
}; };
@ -99,8 +111,10 @@ in
browser = """${cfg.browser}""" browser = """${cfg.browser}"""
dhcp-dns = """${cfg.dhcp-dns}""" dhcp-dns = """${cfg.dhcp-dns}"""
socks5-addr = """${cfg.socks5-addr}""" socks5-addr = """${cfg.socks5-addr}"""
${optionalString cfg.bindInterface ''
bind-device = """${cfg.interface}""" bind-device = """${cfg.interface}"""
''} ''}
''}
exec ${cfg.package}/bin/captive-browser exec ${cfg.package}/bin/captive-browser
''; '';
}; };