summaryrefslogtreecommitdiff
path: root/os/common/pkgs/stalwart-mail-config.nix
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-06-01 19:25:59 +0530
committersinanmohd <sinan@sinanmohd.com>2024-06-01 19:26:13 +0530
commit8febb2fad131dc1ff42a2c667b26b013d64c17b8 (patch)
treecf33b3a20def6ab7836a037b5195cc617647fa9c /os/common/pkgs/stalwart-mail-config.nix
parent5c48d5ad41221dbfa186701ba40404bd2571c242 (diff)
repo: ./nixos -> ./os
Diffstat (limited to 'os/common/pkgs/stalwart-mail-config.nix')
-rw-r--r--os/common/pkgs/stalwart-mail-config.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/os/common/pkgs/stalwart-mail-config.nix b/os/common/pkgs/stalwart-mail-config.nix
new file mode 100644
index 0000000..77fc366
--- /dev/null
+++ b/os/common/pkgs/stalwart-mail-config.nix
@@ -0,0 +1,43 @@
+{ lib,
+ stdenvNoCC,
+ fetchzip,
+ stalwart-mail,
+}:
+
+stdenvNoCC.mkDerivation {
+ pname = stalwart-mail.pname + "-config";
+ version = stalwart-mail.version;
+
+ src = let
+ rev = stalwart-mail.src.rev;
+ owner = stalwart-mail.src.owner;
+ repo = stalwart-mail.src.repo;
+ in fetchzip {
+ url = "https://github.com/${owner}/${repo}/raw/${rev}/resources/config.zip";
+ # gives us a chance to manually verify config changes, if not use
+ # stalwart-mail.src
+ hash = "sha256-ji7+f3BGzVEb9gp5BXCStPR4/Umy93OTMA+DhYI/azk=";
+ };
+
+ outputs = [ "out" ];
+ patchPhase = ''
+ # TODO: remove me
+ # toml spec violation, author said this will be fixed on the next realase
+ sed -e 's/\[storage.fts\]//g' -e 's/default-language = "en"//g' \
+ -i ./common/store.toml
+
+ # outliers as of 0.6.0
+ # smtp/signature.toml:#public-key = "file://%{BASE_PATH}%/etc/dkim/%{DEFAULT_DOMAIN}%.cert"
+ # smtp/signature.toml:private-key = "file://%{BASE_PATH}%/etc/dkim/%{DEFAULT_DOMAIN}%.key"
+ # common/tls.toml:cache = "%{BASE_PATH}%/etc/acme"
+ find -type f \
+ -name '*.toml' \
+ -exec sed 's=%{BASE_PATH}%/etc=${placeholder "out"}=g' -i {} \;
+ '';
+ installPhase = "cp -r ./ $out";
+
+ meta = stalwart-mail.meta // {
+ description = "Configs for" + stalwart-mail.meta.description;
+ maintainers = with lib.maintainers; [ sinanmohd ];
+ };
+}