liminix/modules/ppp/pppoe.nix

31 lines
642 B
Nix
Raw Normal View History

2022-09-25 10:54:31 +00:00
{
2024-09-03 21:57:45 +00:00
lib,
liminix,
output-template,
ppp,
pppoe,
serviceFns,
svc,
writeAshScript,
2024-09-03 23:12:26 +00:00
callPackage
2022-09-25 10:54:31 +00:00
} :
{ interface,
ppp-options,
lcpEcho,
username,
password,
debug
}:
2022-09-25 10:54:31 +00:00
let
name = "${interface.name}.pppoe";
2024-09-03 23:12:26 +00:00
common = callPackage ./common.nix { inherit svc; };
timeoutOpt = if lcpEcho.interval != null then "-T ${builtins.toString (4 * lcpEcho.interval)}" else "";
2024-09-03 23:12:26 +00:00
in common {
inherit name debug username password lcpEcho ppp-options;
command = ''
exec ${ppp}/bin/pppd pty "${pppoe}/bin/pppoe ${timeoutOpt} -I $(output ${interface} ifname)" file /run/${name}/ppp-options
'';
dependencies = [ interface ];
2022-09-25 10:54:31 +00:00
}