From 258c5a7b253e039f6205290389b8bc3a206cf1df Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 11 May 2026 12:24:03 +0900 Subject: [PATCH] temmie/userweb: set up sendmail wrapper --- hosts/temmie/services/userweb.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hosts/temmie/services/userweb.nix b/hosts/temmie/services/userweb.nix index fd3d679..418b95a 100644 --- a/hosts/temmie/services/userweb.nix +++ b/hosts/temmie/services/userweb.nix @@ -64,6 +64,21 @@ let ignoreCollisions = true; }; + sendmailWrapper = pkgs.writeShellApplication { + name = "sendmail"; + runtimeInputs = [ ]; + text = '' + args=("$@") + + if [[ "''${PWD:-}" =~ ^/home/pvv/[^/]+/([^/]+) ]] && [[ "''${BASH_REMATCH[1]}" != "pvv" ]]; then + # Prepend -fusername to the argument list, so bounces go to the user + args=("-f''${BASH_REMATCH[1]}" "''${args[@]}") + fi + + exec '${lib.getExe pkgs.system-sendmail}' "''${args[@]}" + ''; + }; + # https://nixos.org/manual/nixpkgs/stable/#sec-building-environment fhsEnv = pkgs.buildEnv { name = "userweb-env"; @@ -71,6 +86,8 @@ let paths = with pkgs; [ bash + sendmailWrapper + perlEnv pythonEnv phpEnv