diff --git a/flake.lock b/flake.lock index 229ae1b8..673d063e 100644 --- a/flake.lock +++ b/flake.lock @@ -194,11 +194,11 @@ ] }, "locked": { - "lastModified": 1693136143, - "narHash": "sha256-amHprjftc3y/bg8yf4hITCLa+ez5HIi0yGfR7TU6UIc=", + "lastModified": 1723756396, + "narHash": "sha256-Jti6DwKZfMshrpgF6DXOMR8Vl/1ySbY7pANtRTLnvvA=", "ref": "refs/heads/main", - "rev": "a32894b305f042d561500f5799226afd1faf5abb", - "revCount": 9, + "rev": "b7388520e02ad45d802273b27c0b0b9aa7e98364", + "revCount": 13, "type": "git", "url": "https://git.pvv.ntnu.no/Projects/calendar-bot.git" }, diff --git a/hosts/bicep/configuration.nix b/hosts/bicep/configuration.nix index ea18ce39..23504925 100644 --- a/hosts/bicep/configuration.nix +++ b/hosts/bicep/configuration.nix @@ -12,8 +12,7 @@ ./services/mysql.nix ./services/postgres.nix ./services/mysql.nix - # TODO: fix the calendar bot - # ./services/calendar-bot.nix + ./services/calendar-bot.nix ./services/matrix ]; diff --git a/hosts/bicep/services/calendar-bot.nix b/hosts/bicep/services/calendar-bot.nix index 08bff4a9..8eccaa60 100644 --- a/hosts/bicep/services/calendar-bot.nix +++ b/hosts/bicep/services/calendar-bot.nix @@ -2,11 +2,19 @@ let cfg = config.services.pvv-calendar-bot; in { - sops.secrets."calendar-bot/matrix_token" = { - sopsFile = ../../../secrets/bicep/bicep.yaml; - key = "calendar-bot/matrix_token"; - owner = cfg.user; - group = cfg.group; + sops.secrets = { + "calendar-bot/matrix_token" = { + sopsFile = ../../../secrets/bicep/bicep.yaml; + key = "calendar-bot/matrix_token"; + owner = cfg.user; + group = cfg.group; + }; + "calendar-bot/mysql_password" = { + sopsFile = ../../../secrets/bicep/bicep.yaml; + key = "calendar-bot/mysql_password"; + owner = cfg.user; + group = cfg.group; + }; }; services.pvv-calendar-bot = { @@ -18,6 +26,11 @@ in { user = "@bot_calendar:pvv.ntnu.no"; channel = "!gkNLUIhYVpEyLatcRz:pvv.ntnu.no"; }; + database = { + host = "mysql.pvv.ntnu.no"; + user = "calendar-bot"; + passwordFile = config.sops.secrets."calendar-bot/mysql_password".path; + }; secretsFile = config.sops.secrets."calendar-bot/matrix_token".path; onCalendar = "*-*-* 09:00:00"; }; diff --git a/secrets/bicep/bicep.yaml b/secrets/bicep/bicep.yaml index f496e36d..e3fe480d 100644 --- a/secrets/bicep/bicep.yaml +++ b/secrets/bicep/bicep.yaml @@ -1,5 +1,6 @@ calendar-bot: matrix_token: ENC[AES256_GCM,data:zJv9sw6pEzb9hxKT682wsD87HC9iejbps2wl2Z5QW1XZUSBHdcqyg1pxd+jFKTeKGQ==,iv:zDbvF1H98NsECjCtGXS+Y9HIhXowzz9HF9mltqnArog=,tag:/ftcOSQ13ElkVJBxYIMUGQ==,type:str] + mysql_password: ENC[AES256_GCM,data:Gqag8yOgPH3ntoT5TmaqJWv1j+si2qIyz5Ryfw5E2A==,iv:kQDcxnPfwJQcFovI4f87UDt18F8ah3z5xeY86KmdCyY=,tag:A1sCSNXJziAmtUWohqwJgg==,type:str] mysql: password: ENC[AES256_GCM,data:KqEe0TVdeMIzPKsmFg9x0X9xWijnOk306ycyXTm2Tpqo/O0F,iv:Y+hlQ8n1ZIP9ncXBzd2kCSs/DWVTWhiEluFVwZFKRCA=,tag:xlaUk0Wftk62LpYE5pKNQw==,type:str] sops: @@ -62,8 +63,8 @@ sops: cTh5bnJ3WW90aXRCSUp6NHFYeU1tZ0kK4afdtJwGNu6wLRI0fuu+mBVeqVeB0rgX 0q5hwyzjiRnHnyjF38CmcGgydSfDRmF6P+WIMbCwXC6LwfRhAmBGPg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-09-05T23:28:56Z" - mac: ENC[AES256_GCM,data:pCWTkmCQgBOqhejK2sCLQ3H8bRXmXlToQxYmOG0IWDo2eGiZOLuIkZ1/1grYgfxAGiD4ysJod0nJuvo+eAsMeYAy6QJVtrOqO2d9V2NEdzLckXyYvwyJyZoFbNC5EW9471V0m4jLRSh5821ckNo/wtWFR11wfO15tI3MqtD1rtA=,iv:QDnckPl0LegaH0b7V4WAtmVXaL4LN+k3uKHQI2dkW7E=,tag:mScUQBR0ZHl1pi/YztrvFg==,type:str] + lastmodified: "2024-08-15T21:18:33Z" + mac: ENC[AES256_GCM,data:uR5HgeDAYqoqB9kk1V6p0T30+v6WpQJi4+qIeCDRnoUPnQKUVR10hvBhICck+E+Uh8p+tGhM6Uf3YrAJAV0ZCUiNJjtwDJQQLUDT53vdOAXN4xADCQqNuhgVwVMaruoTheEiwOswRuhFeEwy0gBj3Ze2pu47lueHYclmEzumLeQ=,iv:t0UyXN2YaR2m7M/pV2wTLJG5wVfqTIUs7wSQMmyeTVw=,tag:O7dIffzrDAXz3kGx5uazhw==,type:str] pgp: - created_at: "2024-08-04T00:03:40Z" enc: |- @@ -86,4 +87,4 @@ sops: -----END PGP MESSAGE----- fp: F7D37890228A907440E1FD4846B9228E814A2AAC unencrypted_suffix: _unencrypted - version: 3.7.3 + version: 3.9.0