diff options
author | Vincent Ambo <mail@tazj.in> | 2020-06-13T20·52+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-06-13T23·52+0000 |
commit | 268729083eb80c93aa402883085c37e32c8a08cf (patch) | |
tree | 0916bace8073d30976ec752bb9de8c19a06027ae /ops/nixos/mail.nix | |
parent | 9658e96a87178e972b656db0acf3219937013b88 (diff) |
refactor(ops/nixos): Move my NixOS configurations to //users/tazjin r/941
NixOS modules move one level up because it's unlikely that //ops/nixos will contain actual systems at this point (they're user-specific). This is the first users folder, so it is also added to the root readTree invocation for the repository. Change-Id: I546c701145fa204b7ba7518a8a56a783588629e0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/244 Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'ops/nixos/mail.nix')
-rw-r--r-- | ops/nixos/mail.nix | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/ops/nixos/mail.nix b/ops/nixos/mail.nix deleted file mode 100644 index ba4ebfa06026..000000000000 --- a/ops/nixos/mail.nix +++ /dev/null @@ -1,77 +0,0 @@ -# This file configures offlineimap, notmuch and MSMTP. -# -# Some manual configuration is required the first time this is -# applied: -# -# 1. Credential setup. -# 2. Linking of MSMTP config (ln -s /etc/msmtprc ~/.msmtprc) -# 3. Linking of notmuch config (ln -s /etc/notmuch-config ~/.notmuch-config) - -{ config, lib, pkgs, ... }: - -let offlineImapConfig = pkgs.writeText "offlineimaprc" - (builtins.readFile ./dotfiles/offlineimaprc); - -msmtpConfig = pkgs.writeText "msmtprc" - (builtins.readFile ./dotfiles/msmtprc); - -notmuchConfig = pkgs.writeText "notmuch-config" - (builtins.readFile ./dotfiles/notmuch-config); - -tagConfig = pkgs.writeText "notmuch-tags" '' - # Tag emacs-devel mailing list: - -inbox +emacs-devel -- to:emacs-devel@gnu.org OR cc:emacs-devel@gnu.org - - # Tag nix-devel mailing list & discourse: - -inbox +nix-devel -- to:nix-devel@googlegroups.com OR from:nixos1@discoursemail.com - - # Tag my own mail (from other devices) as sent: - -inbox +sent -- from:mail@tazj.in - - # Drafts are always read, duh. - -unread -- tag:draft -''; - -notmuchIndex = pkgs.writeShellScriptBin "notmuch-index" '' - echo "Indexing new mails in notmuch" - - # Index new mail - ${pkgs.notmuch}/bin/notmuch new - - # Apply tags - cat ${tagConfig} | ${pkgs.notmuch}/bin/notmuch tag --batch - - echo "Done indexing new mails" -''; -in { - # Enable OfflineIMAP timer & service: - systemd.user.timers.offlineimap = { - description = "OfflineIMAP timer"; - wantedBy = [ "timers.target" ]; - - timerConfig = { - Unit = "offlineimap.service"; - OnCalendar = "*:0/2"; # every 2 minutes - Persistent = "true"; # persist timer state after reboots - }; - }; - - systemd.user.services.offlineimap = { - description = "OfflineIMAP service"; - path = with pkgs; [ pass notmuch ]; - - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.offlineimap}/bin/offlineimap -u syslog -o -c ${offlineImapConfig}"; - ExecStartPost = "${notmuchIndex}/bin/notmuch-index"; - TimeoutStartSec = "2min"; - }; - }; - - # Link configuration files to /etc/ (from where they will be linked - # further): - environment.etc = { - "msmtprc".source = msmtpConfig; - "notmuch-config".source = notmuchConfig; - }; -} |