properly refactored flame

This commit is contained in:
Danilo Reyes 2025-09-28 11:23:10 -06:00
parent b4417a6acd
commit 6c7439894b
4 changed files with 6 additions and 29 deletions

View File

@ -15,12 +15,7 @@ let
config.my.servers.drpp.enable config.my.servers.drpp.enable
config.my.servers.plex-discord-bot.enable config.my.servers.plex-discord-bot.enable
]; ];
filterNames = filterNames = file: file != "base.nix" && file != "setup.nix" && file != "librewolf.nix";
file:
file != "base.nix"
&& file != "setup.nix"
&& file != "librewolf.nix"
&& file != "server-factory.nix";
autoImport = autoImport =
dir: dir:
builtins.readDir ./${dir} builtins.readDir ./${dir}
@ -36,11 +31,10 @@ in
++ autoImport "servers" ++ autoImport "servers"
++ autoImport "services" ++ autoImport "services"
++ autoImport "shell" ++ autoImport "shell"
++ autoImport "network"
++ [ ++ [
./nix/build.nix ./nix/build.nix
./users/nixremote.nix ./users/nixremote.nix
./network/firewall.nix
./network/nginx.nix
]; ];
options.my = { options.my = {
localhost = lib.mkOption { localhost = lib.mkOption {
@ -154,16 +148,5 @@ in
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedProxySettings = true; recommendedProxySettings = true;
}; };
networking.firewall =
let
ports = [
config.services.nginx.defaultHTTPListenPort
config.services.nginx.defaultSSLListenPort
];
in
{
allowedTCPPorts = ports;
allowedUDPPorts = ports;
};
}; };
} }

View File

@ -50,8 +50,8 @@ in
|> map (srv: srv.port) |> map (srv: srv.port)
) )
++ (lib.optionals config.services.nginx.enable [ ++ (lib.optionals config.services.nginx.enable [
80 config.services.nginx.defaultHTTPListenPort
443 config.services.nginx.defaultSSLListenPort
]); ]);
}; };
} }

View File

@ -15,6 +15,8 @@ let
"kavita" "kavita"
"multi-scrobbler" "multi-scrobbler"
"nix-serve" "nix-serve"
"flame"
"flameSecret"
]; ];
proxyReverseFixServices = [ proxyReverseFixServices = [
"audiobookshelf" "audiobookshelf"

View File

@ -11,10 +11,6 @@ in
flameSecret = setup.mkOptions "flameSecret" "qampqwn4wprhqny8h8zj" 5007; flameSecret = setup.mkOptions "flameSecret" "qampqwn4wprhqny8h8zj" 5007;
}; };
config = lib.mkIf enable { config = lib.mkIf enable {
networking.firewall.allowedTCPPorts = lib.mkIf (!cfg.isLocal || !cfgS.isLocal) [
cfg.port
cfgS.port
];
sops.secrets = { sops.secrets = {
flame.sopsFile = ../../secrets/env.yaml; flame.sopsFile = ../../secrets/env.yaml;
}; };
@ -47,9 +43,5 @@ in
}; };
}; };
}; };
services.nginx.virtualHosts = lib.mkIf enable {
"${cfg.host}" = lib.mkIf cfg.enableProxy (setup.proxyReverse cfg);
"${cfgS.host}" = lib.mkIf cfgS.enableProxy (setup.proxyReverse cfgS);
};
}; };
} }