28 lines
757 B
Nix
28 lines
757 B
Nix
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
pkgs,
|
||
|
...
|
||
|
}:
|
||
|
with lib; let
|
||
|
cfg = config.services.piped;
|
||
|
frontend-package =
|
||
|
pkgs.piped-frontend.override {backendDomain = cfg.backendDomain;};
|
||
|
in {
|
||
|
config = mkIf (cfg.enable && !cfg.disableFrontend && !cfg.disableNginx) {
|
||
|
# https://github.com/TeamPiped/Piped/blob/master/docker/nginx.conf
|
||
|
services.nginx.virtualHosts."${cfg.frontendDomain}" = {
|
||
|
forceSSL = cfg.nginxForceSSL;
|
||
|
enableACME = cfg.nginxEnableACME;
|
||
|
locations."/" = {
|
||
|
root = "${frontend-package}/share/piped-frontend";
|
||
|
index = "index.html index.htm";
|
||
|
};
|
||
|
# I have no idea why try_files for Single Page Apps doesn't work here
|
||
|
extraConfig = ''
|
||
|
error_page 404 =200 /index.html;
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
}
|