tv ppp: reconfigure resolv.conf

This commit is contained in:
tv 2020-10-03 12:24:25 +02:00
parent 3f6a68eab4
commit 885e7857c0

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: let { config, pkgs, ... }: let
lib = import <stockholm/lib>; lib = import <stockholm/lib>;
cfg = { cfg = {
pin = "@${toString <secrets/o2.pin>}"; pin = "@${toString <secrets/o2.pin>}";
@ -6,6 +6,18 @@
ttys.com = "/dev/ttyACM1"; ttys.com = "/dev/ttyACM1";
}; };
in { in {
assertions = [
{
assertion = config.networking.resolvconf.enable;
message = "ppp configuration needs resolvconf";
}
];
environment.etc."ppp/ip-up".source = pkgs.writeDash "ppp.ip-up" ''
${pkgs.openresolv}/bin/resolvconf -a "$IFNAME" < /etc/ppp/resolv.conf
'';
environment.etc."ppp/ip-down".source = pkgs.writeDash "ppp.ip-down" ''
${pkgs.openresolv}/bin/resolvconf -fd "$IFNAME"
'';
environment.etc."ppp/peers/o2".text = /* sh */ '' environment.etc."ppp/peers/o2".text = /* sh */ ''
${cfg.ttys.ppp} ${cfg.ttys.ppp}
921600 921600