update vm file, fix README, add working dir in module

This commit is contained in:
Jonas Heinrich 2025-08-18 16:17:35 +02:00
parent 805e5be3b1
commit 8bd5cace11
5 changed files with 41 additions and 31 deletions

View file

@ -43,7 +43,7 @@ Add the module to your `flake.nix`:
Add this to your `configuration.nix` file Add this to your `configuration.nix` file
```nix ```nix
environment.etc."eintopf-radar-sync-secrets.yml".text = '' environment.etc."mail-quota-warning-secrets.yml".text = ''
accounts: accounts:
- name: Sales - name: Sales
imap_server: mail.example.com imap_server: mail.example.com

View file

@ -1,6 +1,5 @@
check_interval_days: 7 # Minimum days between warnings for same account check_interval_days: 7 # Minimum days between warnings for same account
quota_warning_threshold_percent: 80 quota_warning_threshold_percent: 80
working_dir: /var/lib/mail-quota-warning
accounts: accounts:
- name: Sales - name: Sales

View file

@ -96,6 +96,8 @@ in
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStart = "${lib.getExe pkgs.mail-quota-warning}${lib.optionalString (cfg.secretFile != null) " --config ${cfg.secretFile}"}"; ExecStart = "${lib.getExe pkgs.mail-quota-warning}${lib.optionalString (cfg.secretFile != null) " --config ${cfg.secretFile}"}";
WorkingDirectory = "%S/mail-quota-warning";
StateDirectory = "mail-quota-warning";
# hardening # hardening
AmbientCapabilities = ""; AmbientCapabilities = "";

View file

@ -1,29 +0,0 @@
{ pkgs, ... }:
let
template-karlsunruh = pkgs.stdenv.mkDerivation {
name = "karlsunruh";
src = pkgs.fetchgit {
url = "https://git.project-insanity.org/onny/eintopf-karlsunruh.git";
rev = "0c2a36574260da70da80b379d7475af7b29849c9";
hash = "sha256-GPKlqpztl4INqVyz/4y/vVrkDPHA3rIxtUZB9LNZ96c=";
};
dontBuild = true;
installPhase = ''
cp -r . $out/
'';
};
in
{
services.eintopf = {
enable = true;
settings = {
EINTOPF_THEMES = "eintopf,${template-karlsunruh}";
EINTOPF_ADMIN_PASSWORD = "foobar23";
EINTOPF_ADMIN_EMAIL = "onny@project-insanity.org";
};
};
}

38
vm-mail-quota-warning.py Normal file
View file

@ -0,0 +1,38 @@
{ pkgs, ... }:
{
environment.etc."mail-quota-warning-secrets.yml".text = ''
accounts:
- name: Sales
imap_server: mail.example.com
imap_port: 993
username: sales@example.com
password: secret
- name: Support
imap_server: mail.example.com
imap_port: 993
username: support@example.com
password: secret
mail:
smtp_server: mail.example.com
smtp_port: 587
smtp_username: monitoring@example.com
smtp_password: secret
from_address: monitoring@example.com
recipients:
- admin1@example.com
- admin2@example.com
'';
services.mail-quota-warning = {
enable = true;
settings = {
CHECK_INTERVAL_DAYS = 7;
QUOTA_WARNING_THRESHOLD_PERCENT = 80;
};
secretFile = /etc/mail-quota-warning-secrets.yml;
};
}