mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 19:51:34 +01:00
Enable tailscale
This commit is contained in:
parent
5fac577437
commit
433ab8d024
6 changed files with 41 additions and 4 deletions
|
|
@ -15,5 +15,6 @@
|
|||
./nix-helper.nix
|
||||
./auto-gc.nix
|
||||
./night-light.nix
|
||||
./tailscale.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
29
modules/system/tailscale.nix
Normal file
29
modules/system/tailscale.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.myConfig.tailscale;
|
||||
in
|
||||
{
|
||||
options.myConfig.tailscale = {
|
||||
enable = lib.mkEnableOption "";
|
||||
ssh.enable = lib.mkEnableOption "";
|
||||
exitNode.enable = lib.mkEnableOption "";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops.secrets.tailscale-auth-key = { };
|
||||
|
||||
services.tailscale = {
|
||||
enable = true;
|
||||
|
||||
authKeyFile = config.sops.secrets.tailscale-auth-key.path;
|
||||
openFirewall = true;
|
||||
permitCertUid = "root";
|
||||
|
||||
useRoutingFeatures = if cfg.exitNode.enable then "server" else "client";
|
||||
extraUpFlags = [
|
||||
(lib.mkIf cfg.ssh.enable "--ssh")
|
||||
(lib.mkIf cfg.exitNode.enable "--advertise-exit-node")
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue