chore: format

This commit is contained in:
aprilthepink 2024-05-03 02:19:10 +02:00
parent 22547e64ce
commit 32ba6d0d1e
Signed by: aprl
GPG key ID: BCB934A2909C5460
2 changed files with 28 additions and 27 deletions

View file

@ -17,12 +17,12 @@
inputs.flake-parts.lib.mkFlake { inherit inputs self; } {
systems = import inputs.systems;
flake = {
nixosModules = {
default = {
imports = [ ./module.nix ];
nixpkgs.overlays = [ self.overlays.default ];
};
nixosModules = {
default = {
imports = [ ./module.nix ];
nixpkgs.overlays = [ self.overlays.default ];
};
};
};
imports = [
inputs.treefmt-nix.flakeModule

View file

@ -43,30 +43,31 @@ let
ensureDatabases = lib.singleton cfg.settings.db.dbname;
};
};
nginxConfig = lib.mkIf cfg.nginx.enable {
services.nginx = let
ip = if cfg.address == "0.0.0.0" then "127.0.0.1" else cfg.address;
in
{
enable = true;
virtualHosts.${cfg.domain} = {
locations."/".proxyPass =
if cfg.serviceScale == 1 then
"http://${ip}:${toString cfg.port}"
else "http://upstream-invidious";
nginxConfig = lib.mkIf cfg.nginx.enable {
services.nginx =
let
ip = if cfg.address == "0.0.0.0" then "127.0.0.1" else cfg.address;
in
{
enable = true;
virtualHosts.${cfg.domain} = {
locations."/".proxyPass =
if cfg.serviceScale == 1 then
"http://${ip}:${toString cfg.port}"
else "http://upstream-invidious";
enableACME = lib.mkDefault true;
forceSSL = lib.mkDefault true;
enableACME = lib.mkDefault true;
forceSSL = lib.mkDefault true;
};
upstreams = lib.mkIf (cfg.serviceScale > 1) {
"upstream-invidious".servers = builtins.listToAttrs (builtins.genList
(scaleIndex: {
name = "${ip}:${toString (cfg.port + scaleIndex)}";
value = { };
})
cfg.serviceScale);
};
};
upstreams = lib.mkIf (cfg.serviceScale > 1) {
"upstream-invidious".servers = builtins.listToAttrs (builtins.genList
(scaleIndex: {
name = "${ip}:${toString (cfg.port + scaleIndex)}";
value = { };
})
cfg.serviceScale);
};
};
assertions = [{
assertion = cfg.domain != null;