mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(hakurei): cloudflared
This commit is contained in:
parent
ddcdcb0e0e
commit
7ded53ccc1
10 changed files with 258 additions and 15 deletions
40
modules/nixos/nginx-local.nix
Normal file
40
modules/nixos/nginx-local.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkBefore;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (config.services) tailscale;
|
||||
localModule = { config, ... }: {
|
||||
options = with lib.types; {
|
||||
local = {
|
||||
enable = mkEnableOption "local traffic only";
|
||||
};
|
||||
};
|
||||
config = mkIf config.local.enable {
|
||||
extraConfig = let
|
||||
tailscaleAllow = ''
|
||||
allow fd7a:115c:a1e0::/96;
|
||||
allow fd7a:115c:a1e0:ab12::/64;
|
||||
allow 100.64.0.0/10;
|
||||
'';
|
||||
in mkBefore ''
|
||||
allow 127.0.0.0/8;
|
||||
allow ::1;
|
||||
allow 10.1.1.0/24;
|
||||
allow fd0a::/64;
|
||||
allow fe80::/64;
|
||||
${optionalString tailscale.enable tailscaleAllow}
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options = with lib.types; {
|
||||
services.nginx.virtualHosts = mkOption {
|
||||
type = attrsOf (submodule localModule);
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue