try to fix tun

This commit is contained in:
RingOfStorms (Joshua Bell) 2026-01-06 16:57:04 -06:00
parent 0f5e844277
commit 4bc645061b

View file

@ -88,6 +88,31 @@
inputs.common.nixosModules.tty_caps_esc
inputs.common.nixosModules.zsh
inputs.common.nixosModules.tailnet
(
{ pkgs, lib, ... }:
{
# Some boots come up without `/dev/net/tun` until `modprobe tun`.
# This makes `tailscaled` reliable by forcing the module load
# before it starts.
systemd.services.ensure-tun = {
description = "Ensure tun module is loaded";
wantedBy = [ "tailscaled.service" ];
before = [ "tailscaled.service" ];
after = [ "systemd-modules-load.service" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.kmod}/bin/modprobe tun";
};
};
systemd.services.tailscaled = {
after = lib.mkAfter [ "ensure-tun.service" ];
wants = lib.mkAfter [ "ensure-tun.service" ];
requires = lib.mkAfter [ "ensure-tun.service" ];
};
}
)
inputs.common.nixosModules.remote_lio_builds
(