mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 13:39:15 +03:00
nixos/plausible: add package option
This commit is contained in:
parent
4b688e6efd
commit
efde50d9f5
1 changed files with 8 additions and 6 deletions
|
@ -9,6 +9,8 @@ in {
|
||||||
options.services.plausible = {
|
options.services.plausible = {
|
||||||
enable = mkEnableOption (lib.mdDoc "plausible");
|
enable = mkEnableOption (lib.mdDoc "plausible");
|
||||||
|
|
||||||
|
package = mkPackageOptionMD pkgs "plausible" { };
|
||||||
|
|
||||||
releaseCookiePath = mkOption {
|
releaseCookiePath = mkOption {
|
||||||
type = with types; either str path;
|
type = with types; either str path;
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
|
@ -180,12 +182,12 @@ in {
|
||||||
|
|
||||||
services.epmd.enable = true;
|
services.epmd.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.plausible ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
systemd.services = mkMerge [
|
systemd.services = mkMerge [
|
||||||
{
|
{
|
||||||
plausible = {
|
plausible = {
|
||||||
inherit (pkgs.plausible.meta) description;
|
inherit (cfg.package.meta) description;
|
||||||
documentation = [ "https://plausible.io/docs/self-hosting" ];
|
documentation = [ "https://plausible.io/docs/self-hosting" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = optional cfg.database.clickhouse.setup "clickhouse.service"
|
after = optional cfg.database.clickhouse.setup "clickhouse.service"
|
||||||
|
@ -233,7 +235,7 @@ in {
|
||||||
SMTP_USER_NAME = cfg.mail.smtp.user;
|
SMTP_USER_NAME = cfg.mail.smtp.user;
|
||||||
});
|
});
|
||||||
|
|
||||||
path = [ pkgs.plausible ]
|
path = [ cfg.package ]
|
||||||
++ optional cfg.database.postgres.setup config.services.postgresql.package;
|
++ optional cfg.database.postgres.setup config.services.postgresql.package;
|
||||||
script = ''
|
script = ''
|
||||||
export CONFIG_DIR=$CREDENTIALS_DIRECTORY
|
export CONFIG_DIR=$CREDENTIALS_DIRECTORY
|
||||||
|
@ -241,10 +243,10 @@ in {
|
||||||
export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
|
export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
${pkgs.plausible}/createdb.sh
|
${cfg.package}/createdb.sh
|
||||||
${pkgs.plausible}/migrate.sh
|
${cfg.package}/migrate.sh
|
||||||
${optionalString cfg.adminUser.activate ''
|
${optionalString cfg.adminUser.activate ''
|
||||||
if ! ${pkgs.plausible}/init-admin.sh | grep 'already exists'; then
|
if ! ${cfg.package}/init-admin.sh | grep 'already exists'; then
|
||||||
psql -d plausible <<< "UPDATE users SET email_verified=true;"
|
psql -d plausible <<< "UPDATE users SET email_verified=true;"
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue