feat: tailscale homelab module

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-28 21:28:28 -03:00
parent 8ca9a7a5d1
commit dc25612173
4 changed files with 40 additions and 5 deletions

View File

@@ -23,6 +23,12 @@
ip = "100.66.139.89";
localIp = "192.168.1.10";
tailscale = {
enable = true;
mode = "both";
exitNode = true;
};
forgejo = {
enable = true;
settings.users."user1" = {

View File

@@ -14,11 +14,6 @@
nameservers = [ "100.100.100.100" "1.1.1.1" "8.8.8.8" ];
};
services.tailscale = {
enable = true;
useRoutingFeatures = "both";
};
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;

View File

@@ -26,6 +26,7 @@ in
./adguard.nix
./caddy.nix
./forgejo.nix
./tailscale.nix
];
options.homelab = with lib; with lib.types; {
enable = mkEnableOption "";

View File

@@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
let
cfg = config.homelab.tailscale;
in
{
imports = [
./network.nix
];
options.homelab.tailscale = with lib; with lib.types; {
enable = mkEnableOption "";
mode = mkOption {
type = enum [
"client"
"server"
"both"
];
default = "both";
};
exitNode = mkOption {
type = bool;
default = false;
};
settings = { };
};
config = lib.mkIf cfg.enable {
services.tailscale = {
enable = true;
useRoutingFeatures = cfg.mode;
};
};
}