summaryrefslogtreecommitdiff
path: root/hosts/vidhar/dsl.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/vidhar/dsl.nix')
-rw-r--r--hosts/vidhar/dsl.nix64
1 files changed, 64 insertions, 0 deletions
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 @@
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 pppInterface = config.networking.pppInterface;
7in {
8 options = {
9 networking.pppInterface = mkOption {
10 type = types.str;
11 default = "dsl";
12 };
13 };
14
15 config = {
16 networking.vlans = {
17 telekom = {
18 id = 7;
19 interface = "eno2";
20 };
21 };
22
23 services.pppd = {
24 enable = true;
25 peers.telekom.config = ''
26 nodefaultroute
27 ifname ${pppInterface}
28 lcp-echo-failure 1
29 lcp-echo-interval 1
30 maxfail 0
31 mtu 1492
32 mru 1492
33 plugin rp-pppoe.so
34 name telekom
35 user 002576900250551137425220#0001@t-online.de
36 telekom
37 debug
38 '';
39 };
40 systemd.services."pppd-telekom".serviceConfig = lib.mkForce {
41 ExecStart = "${lib.getBin pkgs.ppp}/sbin/pppd call telekom nodetach nolog";
42 Restart = "always";
43 RestartSec = 5;
44
45 RuntimeDirectory = "pppd";
46 RuntimeDirectoryPreserve = true;
47 };
48 sops.secrets."pap-secrets" = {
49 format = "binary";
50 sopsFile = ./pap-secrets;
51 path = "/etc/ppp/pap-secrets";
52 };
53
54 environment.etc = {
55 "ppp/ip-up" = {
56 text = ''
57 #!${pkgs.runtimeShell}
58 ${pkgs.iproute}/bin/ip route add default via "$5" dev "${pppInterface}" metric 512
59 '';
60 mode = "0555";
61 };
62 };
63 };
64}