From b7388520e02ad45d802273b27c0b0b9aa7e98364 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 15 Aug 2024 23:13:16 +0200 Subject: [PATCH] Update module --- module.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/module.nix b/module.nix index cf4ad60..16ed4c6 100644 --- a/module.nix +++ b/module.nix @@ -45,6 +45,23 @@ in }; }; + database = { + host = mkOption { + type = types.str; + description = mdDoc "MySQL host to connect to"; + example = "mysql.pvv.ntnu.no"; + }; + user = mkOption { + type = types.str; + description = mdDoc "MySQL username to authenticate with"; + example = "calendar-bot"; + }; + passwordFile = mkOption { + type = types.path; + description = mdDoc "Path to file containing MySQL password"; + }; + }; + secretsFile = mkOption { type = types.path; description = mdDoc "Path to secrets file that defines MATRIX_ACCESS_TOKEN"; @@ -81,11 +98,15 @@ in MATRIX_USER=${cfg.settings.matrix.user} ANNOUNCEMENT_CHANNEL=${cfg.settings.matrix.channel} MATRIX_TOKEN=@MATRIX_ACCESS_TOKEN@ + MYSQL_HOST=${cfg.settings.database.host} + MYSQL_USER=${cfg.settings.database.user} + MYSQL_PASSWORD=@MYSQL_PASSWORD@ ''; in '' install -Dm600 ${envFile} /run/pvv-calendar-bot/env ${pkgs.replace-secret}/bin/replace-secret '@MATRIX_ACCESS_TOKEN@' ${cfg.settings.secretsFile} /run/pvv-calendar-bot/env + #${pkgs.replace-secret}/bin/replace-secret '@MYSQL_PASSWORD@' ${cfg.settings.database.passwordFile} /run/pvv-calendar-bot/env ''; serviceConfig = {