From 9663c40408fde29d5ca7ea9a71373bef4b16ae8c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 15 Nov 2021 09:07:04 +0059 Subject: vidhar: dsl --- hosts/vidhar/dsl.nix | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 hosts/vidhar/dsl.nix (limited to 'hosts/vidhar/dsl.nix') diff --git a/hosts/vidhar/dsl.nix b/hosts/vidhar/dsl.nix new file mode 100644 index 00000000..bdce55a6 --- /dev/null +++ b/hosts/vidhar/dsl.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + pppInterface = config.networking.pppInterface; +in { + options = { + networking.pppInterface = mkOption { + type = types.str; + default = "dsl"; + }; + }; + + config = { + networking.vlans = { + telekom = { + id = 7; + interface = "eno2"; + }; + }; + + services.pppd = { + enable = true; + peers.telekom.config = '' + nodefaultroute + ifname ${pppInterface} + lcp-echo-failure 1 + lcp-echo-interval 1 + maxfail 0 + mtu 1492 + mru 1492 + plugin rp-pppoe.so + name telekom + user 002576900250551137425220#0001@t-online.de + telekom + debug + ''; + }; + systemd.services."pppd-telekom".serviceConfig = lib.mkForce { + ExecStart = "${lib.getBin pkgs.ppp}/sbin/pppd call telekom nodetach nolog"; + Restart = "always"; + RestartSec = 5; + + RuntimeDirectory = "pppd"; + RuntimeDirectoryPreserve = true; + }; + sops.secrets."pap-secrets" = { + format = "binary"; + sopsFile = ./pap-secrets; + path = "/etc/ppp/pap-secrets"; + }; + + environment.etc = { + "ppp/ip-up" = { + text = '' + #!${pkgs.runtimeShell} + ${pkgs.iproute}/bin/ip route add default via "$5" dev "${pppInterface}" metric 512 + ''; + mode = "0555"; + }; + }; + }; +} -- cgit v1.2.3