pppoe.nix (705B)
1 { 2 lib, 3 liminix, 4 output-template, 5 ppp, 6 pppoe, 7 serviceFns, 8 svc, 9 writeAshScript, 10 callPackage, 11 }: 12 { 13 interface, 14 ppp-options, 15 lcpEcho, 16 bandwidth, 17 username, 18 password, 19 debug, 20 }: 21 let 22 name = "${interface.name}.pppoe"; 23 common = callPackage ./common.nix { inherit svc; }; 24 25 timeoutOpt = 26 if lcpEcho.interval != null then "-T ${builtins.toString (4 * lcpEcho.interval)}" else ""; 27 in 28 common { 29 inherit 30 name 31 debug 32 username 33 password 34 lcpEcho 35 bandwidth 36 ppp-options 37 ; 38 command = '' 39 exec ${ppp}/bin/pppd pty "${pppoe}/bin/pppoe ${timeoutOpt} -I $(output ${interface} ifname)" file /run/${name}/ppp-options 40 ''; 41 dependencies = [ interface ]; 42 }