services: plausible: init
This commit is contained in:
parent
5984b39f69
commit
9deefd02e5
2 changed files with 44 additions and 0 deletions
39
modules/services/plausible/module.nix
Normal file
39
modules/services/plausible/module.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
cfg = config.modules.system.services.plausible;
|
||||
|
||||
port = 4030;
|
||||
domain = "analytics.copeberg.org";
|
||||
in {
|
||||
options.modules.system.services.plausible.enable = mkEnableOption "Plausible, an analytics service";
|
||||
config = mkIf cfg.enable {
|
||||
services.plausible = {
|
||||
enable = true;
|
||||
server = {
|
||||
baseUrl = domain;
|
||||
secretKeybaseFile = "/run/secrets/plausible-secret-key-base";
|
||||
disableRegistration = false;
|
||||
};
|
||||
database.postgres = {
|
||||
dbname = "plausible";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.${domain} = {
|
||||
addSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -29,6 +29,7 @@ in {
|
|||
"git"
|
||||
"grafana"
|
||||
"stalwart"
|
||||
"plausible"
|
||||
];
|
||||
|
||||
ensureUsers = [
|
||||
|
@ -54,6 +55,10 @@ in {
|
|||
name = "stalwart";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "plausible";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
settings = {
|
||||
# taken from https://pgconfigurator.cybertec.at/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue