Refactor Tailscale and Restic Into Common Nixos Modules.

This commit is contained in:
Lorenzo Good 2025-02-07 17:14:52 -06:00
parent 6b3755ca06
commit 9df92651ad
Signed by: lorenzo
GPG key ID: 7FCD64BD81180ED0
5 changed files with 110 additions and 47 deletions

View file

@ -0,0 +1,25 @@
{
config,
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types mkIf;
cfg = config.foehammer.tailscale;
in {
options.foehammer.tailscale = {
enable = mkEnableOption "Enable tailscale";
authKeyFile = mkOption {
type = types.nullOr types.path;
};
};
config = mkIf cfg.enable {
services.tailscale = {
enable = true;
authKeyFile = cfg.authKeyFile;
openFirewall = true;
};
networking.firewall.trustedInterfaces = ["tailscale0"];
};
}