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; } { inputs.flake-parts.lib.mkFlake { inherit inputs self; } {
systems = import inputs.systems; systems = import inputs.systems;
flake = { flake = {
nixosModules = { nixosModules = {
default = { default = {
imports = [ ./module.nix ]; imports = [ ./module.nix ];
nixpkgs.overlays = [ self.overlays.default ]; nixpkgs.overlays = [ self.overlays.default ];
};
}; };
};
}; };
imports = [ imports = [
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule

View file

@ -43,30 +43,31 @@ let
ensureDatabases = lib.singleton cfg.settings.db.dbname; ensureDatabases = lib.singleton cfg.settings.db.dbname;
}; };
}; };
nginxConfig = lib.mkIf cfg.nginx.enable { nginxConfig = lib.mkIf cfg.nginx.enable {
services.nginx = let services.nginx =
ip = if cfg.address == "0.0.0.0" then "127.0.0.1" else cfg.address; let
in ip = if cfg.address == "0.0.0.0" then "127.0.0.1" else cfg.address;
{ in
enable = true; {
virtualHosts.${cfg.domain} = { enable = true;
locations."/".proxyPass = virtualHosts.${cfg.domain} = {
if cfg.serviceScale == 1 then locations."/".proxyPass =
"http://${ip}:${toString cfg.port}" if cfg.serviceScale == 1 then
else "http://upstream-invidious"; "http://${ip}:${toString cfg.port}"
else "http://upstream-invidious";
enableACME = lib.mkDefault true; enableACME = lib.mkDefault true;
forceSSL = 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 = [{ assertions = [{
assertion = cfg.domain != null; assertion = cfg.domain != null;