From 78e2a32680d572b38d3df2d00170e5234c6e88f1 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 30 Dec 2022 17:38:23 +0100 Subject: tv autotether: init --- tv/2configs/autotether.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tv/2configs/autotether.nix (limited to 'tv/2configs') diff --git a/tv/2configs/autotether.nix b/tv/2configs/autotether.nix new file mode 100644 index 0000000..43b5575 --- /dev/null +++ b/tv/2configs/autotether.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: let + cfg.serial = "17e064850405"; +in { + systemd.services.usb_tether.serviceConfig = { + SyslogIdentifier = "usb_tether"; + ExecStartPre = "${pkgs.android-tools}/bin/adb -s ${cfg.serial} wait-for-device"; + ExecStart = "${pkgs.android-tools}/bin/adb -s ${cfg.serial} shell svc usb setFunctions rndis"; + }; + services.udev.extraRules = /* sh */ '' + ACTION=="add", SUBSYSTEM=="net", KERNEL=="usb*", NAME="android" + + ACTION=="add", SUBSYSTEM=="usb", ATTR{serial}=="${cfg.serial}", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}="usb_tether.service" + ''; + systemd.network.networks.android = { + matchConfig.Name = "android"; + DHCP = "yes"; + }; +} -- cgit v1.2.3 From 01a49bf237d2777111eb5dd1f6210a26792f062b Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 30 Dec 2022 20:13:59 +0100 Subject: tv retiolum: use networkd --- tv/2configs/retiolum.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tv/2configs') diff --git a/tv/2configs/retiolum.nix b/tv/2configs/retiolum.nix index de77de3..1b176e0 100644 --- a/tv/2configs/retiolum.nix +++ b/tv/2configs/retiolum.nix @@ -11,6 +11,16 @@ with import ./lib; LocalDiscovery = yes ''; tincPackage = pkgs.tinc_pre; + tincUp = lib.mkIf config.systemd.network.enable ""; + }; + systemd.network.networks.retiolum = { + matchConfig.Name = "retiolum"; + address = let + inherit (config.krebs.build.host.nets.retiolum) ip4 ip6; + in [ + "${ip4.addr}/${toString ip4.prefixLength}" + "${ip6.addr}/${toString ip6.prefixLength}" + ]; }; tv.iptables.input-internet-accept-tcp = singleton "tinc"; tv.iptables.input-internet-accept-udp = singleton "tinc"; -- cgit v1.2.3