From b663547364bc67b5fe1b75c05486192ba97a6ebf Mon Sep 17 00:00:00 2001 From: Qubasa Date: Wed, 3 Jul 2024 18:05:51 +0200 Subject: [PATCH] matrix-bot: Fix incorrect env var name --- modules/matrix-bot.nix | 8 ++++---- pkgs/matrix-bot/default.nix | 5 +++-- pkgs/matrix-bot/matrix_bot/__init__.py | 4 ++-- pkgs/matrix-bot/matrix_bot/changelog_bot.py | 2 ++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/matrix-bot.nix b/modules/matrix-bot.nix index 382d07e..9dd6e4a 100644 --- a/modules/matrix-bot.nix +++ b/modules/matrix-bot.nix @@ -15,15 +15,15 @@ in after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; environment = { - MATRIX_PASSWORD = "%d/MATRIX_PASSWORD"; - OPENAI_API_KEY = "%d/OPENAI_API_KEY"; + MATRIX_PASSWORD_FILE = "%d/MATRIX_PASSWORD_FILE"; + OPENAI_API_KEY_FILE = "%d/OPENAI_API_KEY_FILE"; HOME = "/run/${name}"; }; serviceConfig = { LoadCredential = [ - "MATRIX_PASSWORD:${config.sops.secrets.web01-matrix-password-clan-bot.path}" - "OPENAI_API_KEY:${config.sops.secrets.qubasas-openai-api-key.path}" + "MATRIX_PASSWORD_FILE:${config.sops.secrets.web01-matrix-password-clan-bot.path}" + "OPENAI_API_KEY_FILE:${config.sops.secrets.qubasas-openai-api-key.path}" ]; DynamicUser = true; RuntimeDirectory = "${name}"; diff --git a/pkgs/matrix-bot/default.nix b/pkgs/matrix-bot/default.nix index f6244c0..23e8662 100644 --- a/pkgs/matrix-bot/default.nix +++ b/pkgs/matrix-bot/default.nix @@ -5,6 +5,7 @@ aiofiles, aiohttp, markdown2, + git, ... }: @@ -17,7 +18,7 @@ let markdown2 ]; - runtimeDependencies = [ ]; + runtimeDependencies = [ git ]; testDependencies = pythonDependencies ++ runtimeDependencies ++ [ ]; in @@ -28,7 +29,7 @@ python3.pkgs.buildPythonApplication { nativeBuildInputs = [ setuptools ]; - propagatedBuildInputs = pythonDependencies; + propagatedBuildInputs = pythonDependencies ++ runtimeDependencies; passthru.testDependencies = testDependencies; diff --git a/pkgs/matrix-bot/matrix_bot/__init__.py b/pkgs/matrix-bot/matrix_bot/__init__.py index ad1d41f..eb4935a 100644 --- a/pkgs/matrix-bot/matrix_bot/__init__.py +++ b/pkgs/matrix-bot/matrix_bot/__init__.py @@ -119,9 +119,9 @@ def create_parser(prog: str | None = None) -> argparse.ArgumentParser: def matrix_password() -> str: - matrix_password_file = environ.get("MATRIX_PASSWORD", default=None) + matrix_password_file = environ.get("MATRIX_PASSWORD_FILE", default=None) if matrix_password_file is None: - raise Exception("MATRIX_PASSWORD environment variable is not set") + raise Exception("MATRIX_PASSWORD_FILE environment variable is not set") with open(matrix_password_file) as f: return f.read().strip() diff --git a/pkgs/matrix-bot/matrix_bot/changelog_bot.py b/pkgs/matrix-bot/matrix_bot/changelog_bot.py index 4fc5d3d..40069ad 100644 --- a/pkgs/matrix-bot/matrix_bot/changelog_bot.py +++ b/pkgs/matrix-bot/matrix_bot/changelog_bot.py @@ -168,6 +168,8 @@ Ensure the following: - Discard uninteresting changes - Keep the summary as brief as possible - Use present tense +- Our commit messages are in the format: "scope: message". For example: "changelog: Add a new feature" +- Only ever mention the same feature once The changelog is as follows: --- """