mirror of
https://github.com/RGBCube/ncc
synced 2025-07-29 11:07:44 +00:00
plausible: add to other services
This commit is contained in:
parent
e7cf9c7239
commit
f8c824dd0a
6 changed files with 31 additions and 10 deletions
|
@ -111,6 +111,10 @@ in {
|
|||
};
|
||||
|
||||
services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate {
|
||||
extraConfig = ''
|
||||
${config.services.plausible.extraNginxConfigFor fqdn}
|
||||
'';
|
||||
|
||||
locations."/".proxyPass = "http://[::1]:${toString port}";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -77,6 +77,8 @@ in {
|
|||
# Grafana sets `nosniff` while not setting the content type properly,
|
||||
# so everything breaks with it. Unset the header.
|
||||
proxy_hide_header X-Content-Type-Options;
|
||||
|
||||
${config.services.plausible.extraNginxConfigFor fqdn}
|
||||
'';
|
||||
|
||||
proxyPass = "http://[::1]:${toString port}";
|
||||
|
|
|
@ -111,6 +111,8 @@ in {
|
|||
};
|
||||
|
||||
services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate {
|
||||
extraConfig = config.services.nginx.headers;
|
||||
extraConfig = ''
|
||||
${config.services.nginx.headers}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ config, self, lib, ... }: let
|
||||
inherit (config.networking) domain;
|
||||
inherit (lib) enabled merge;
|
||||
inherit (lib) enabled merge mkConst;
|
||||
|
||||
fqdn = "shekels.${domain}";
|
||||
port = 8007;
|
||||
|
@ -10,14 +10,14 @@ in {
|
|||
(self + /modules/postgresql.nix)
|
||||
];
|
||||
|
||||
secrets.plausibleKey = {
|
||||
config.secrets.plausibleKey = {
|
||||
file = ./key.age;
|
||||
owner = "plausible";
|
||||
};
|
||||
|
||||
services.postgresql.ensure = [ "plausible" ];
|
||||
config.services.postgresql.ensure = [ "plausible" ];
|
||||
|
||||
services.plausible = enabled {
|
||||
config.services.plausible = enabled {
|
||||
server = {
|
||||
disableRegistration = true; # Setting it explicitly just in case.
|
||||
|
||||
|
@ -30,7 +30,16 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate {
|
||||
options.services.plausible.extraNginxConfigFor = mkConst /* nginx */ (domain: ''
|
||||
proxy_set_header Accept-Encoding ""; # Substitution won't work if it is compressed.
|
||||
sub_filter "</head>" '<script defer data-domain="${domain}" src="https://${fqdn}/js/script.js"></script></head>';
|
||||
sub_filter_last_modified on;
|
||||
sub_filter_once on;
|
||||
'');
|
||||
|
||||
config.services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate {
|
||||
extraConfig = config.services.plausible.extraNginxConfigFor fqdn;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://[::1]:${toString port}";
|
||||
proxyWebsockets = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue