Refactor Tailscale and Restic Into Common Nixos Modules.
This commit is contained in:
parent
6b3755ca06
commit
9df92651ad
5 changed files with 110 additions and 47 deletions
25
nixos/common/tailscale.nix
Normal file
25
nixos/common/tailscale.nix
Normal 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"];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue