tailscale

This commit is contained in:
Callum Leslie 2024-09-02 15:05:48 +01:00
parent 961d41b9bf
commit c558bad713
Signed by: cleslie
GPG key ID: D382C4AFEECEAA90
15 changed files with 106 additions and 15 deletions

View file

@ -6,12 +6,14 @@
./deploy.nix
./keys.nix
./secret.nix
./tailscale.nix
];
sharedModules = with nixosModules; [
nix
hm
boot
deploy
tailscale
secret
];
in {inherit nixosModules sharedModules;}

View file

@ -5,9 +5,9 @@
...
}:
with lib; let
cfg = config.services.remote-deploy;
cfg = config.c.services.remote-deploy;
in {
options.services.remote-deploy = {
options.c.services.remote-deploy = {
enable = mkEnableOption "Enable remote deployment with nixinate.";
host = mkOption {
type = types.str;

36
modules/tailscale.nix Normal file
View file

@ -0,0 +1,36 @@
{
config,
options,
lib,
...
}:
with lib; let
cfg = config.c.services.mesh;
in {
options.c.services.mesh = {
enable = mkEnableOption "Enable tailscale daemon.";
exitNode = mkOption {
type = types.bool;
default = false;
description = "Enable advertising as an exit node.";
};
keyFile = mkOption {
type = types.path;
description = "Path to key file.";
};
};
config = mkIf cfg.enable {
services.tailscale = {
enable = true;
openFirewall = true;
#authKeyFile = config.age.secrets.mesh-conf.path;
authKeyFile = cfg.keyFile;
extraUpFlags = ["--login-server" "https://mesh.cleslie.uk"];
extraSetFlags = [(mkIf cfg.exitNode "--advertise-exit-node")];
};
networking.firewall = {
#checkReversePath = "loose";
trustedInterfaces = [config.services.tailscale.interfaceName];
};
};
}