alpha
Login
or
Join now
lass.pds.lassul.us
/
superconfig
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
1
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
1
Pipelines
mail: just import mutt wrapper
author
lassulus
date
1 year ago
(Jun 18, 2025, 2:31 PM CEST)
commit
6f302fc0
6f302fc00738f06e56679ecaf26238ce0541b57c
parent
23667646
23667646252046c9aad37bea9aba595c1df58490
+2
-322
1 changed file
Expand all
Collapse all
Unified
Split
2configs
mail.nix
+2
-322
2configs/mail.nix
View file
Reviewed
···
1
1
-
{ lib, pkgs, ... }:
2
2
-
3
3
-
let
4
4
-
5
5
-
msmtprc = pkgs.writeText "msmtprc" ''
6
6
-
defaults
7
7
-
logfile ~/.msmtp.log
8
8
-
account prism
9
9
-
host prism.r
10
10
-
account c-base
11
11
-
from lassulus@c-base.org
12
12
-
host c-mail.c-base.org
13
13
-
port 465
14
14
-
tls on
15
15
-
tls_starttls off
16
16
-
auth on
17
17
-
user lassulus
18
18
-
passwordeval pass show c-base/pass
19
19
-
account default: prism
20
20
-
'';
21
21
-
22
22
-
notmuch-config = pkgs.writeText "notmuch-config" ''
23
23
-
[database]
24
24
-
path=/home/lass/Maildir
25
25
-
mail_root=/home/lass/Maildir
26
26
-
27
27
-
[user]
28
28
-
name=lassulus
29
29
-
primary_email=lassulus@lassul.us
30
30
-
other_email=lass@mors.r;${lib.concatStringsSep ";" (lib.flatten (lib.attrValues mailboxes))}
31
31
-
32
32
-
[new]
33
33
-
tags=unread;inbox;
34
34
-
ignore=
35
35
-
36
36
-
[search]
37
37
-
exclude_tags=deleted;spam;
38
38
-
39
39
-
[maildir]
40
40
-
synchronize_flags=true
41
41
-
'';
42
42
-
43
43
-
msmtp = pkgs.writeBashBin "msmtp" ''
44
44
-
${pkgs.coreutils}/bin/tee >(${pkgs.notmuch}/bin/notmuch insert +sent) | \
45
45
-
${pkgs.msmtp}/bin/msmtp -C ${msmtprc} "$@"
46
46
-
'';
47
47
-
48
48
-
mailcap = pkgs.writeText "mailcap" ''
49
49
-
text/html; ${pkgs.elinks}/bin/elinks -dump ; copiousoutput;
50
50
-
'';
51
51
-
52
52
-
mailboxes = {
53
53
-
afra = [ "to:afra@afra-berlin.de" ];
54
54
-
c-base = [ "to:c-base.org" ];
55
55
-
coins = [
56
56
-
"to:btce@lassul.us"
57
57
-
"to:coinbase@lassul.us"
58
58
-
"to:polo@lassul.us"
59
59
-
"to:bitwala@lassul.us"
60
60
-
"to:payeer@lassul.us"
61
61
-
"to:gatehub@lassul.us"
62
62
-
"to:bitfinex@lassul.us"
63
63
-
"to:binance@lassul.us"
64
64
-
"to:bitcoin.de@lassul.us"
65
65
-
"to:robinhood@lassul.us"
66
66
-
];
67
67
-
dezentrale = [ "to:dezentrale.space" ];
68
68
-
dhl = [ "to:dhl@lassul.us" ];
69
69
-
dn42 = [ "to:dn42@lists.nox.tf" ];
70
70
-
eloop = [ "to:eloop.org" ];
71
71
-
github = [ "to:github@lassul.us" ];
72
72
-
gmail = [
73
73
-
"to:gmail@lassul.us"
74
74
-
"to:lassulus@gmail.com"
75
75
-
"lassulus@googlemail.com"
76
76
-
];
77
77
-
india = [
78
78
-
"to:hillhackers@lists.hillhacks.in"
79
79
-
"to:hackbeach@lists.hackbeach.in"
80
80
-
"to:hackbeach@mail.hackbeach.in"
81
81
-
];
82
82
-
kaosstuff = [
83
83
-
"to:gearbest@lassul.us"
84
84
-
"to:banggood@lassul.us"
85
85
-
"to:tomtop@lassul.us"
86
86
-
];
87
87
-
lugs = [ "to:lugs@lug-s.org" ];
88
88
-
meetup = [ "to:meetup@lassul.us" ];
89
89
-
nix = [
90
90
-
"to:nix-devel@googlegroups.com"
91
91
-
"to:nix@lassul.us"
92
92
-
];
93
93
-
patreon = [ "to:patreon@lassul.us" ];
94
94
-
paypal = [ "to:paypal@lassul.us" ];
95
95
-
ptl = [ "to:ptl@posttenebraslab.ch" ];
96
96
-
retiolum = [ "to:lass@mors.r" ];
97
97
-
security = [
98
98
-
"to:seclists.org"
99
99
-
"to:bugtraq"
100
100
-
"to:securityfocus@lassul.us"
101
101
-
"to:security-announce@lists.apple.com"
102
102
-
];
103
103
-
shack = [ "to:shackspace.de" ];
104
104
-
steam = [ "to:steam@lassul.us" ];
105
105
-
tinc = [
106
106
-
"to:tinc@tinc-vpn.org"
107
107
-
"to:tinc-devel@tinc-vpn.org"
108
108
-
];
109
109
-
wireguard = [ "to:wireguard@lists.zx2c4" ];
110
110
-
zzz = [
111
111
-
"to:pizza@lassul.us"
112
112
-
"to:spam@krebsco.de"
113
113
-
];
114
114
-
};
115
115
-
116
116
-
tag-new-mails = pkgs.writeDashBin "nm-tag-init" ''
117
117
-
${pkgs.notmuch}/bin/notmuch new
118
118
-
${lib.concatMapStringsSep "\n" (i: ''
119
119
-
mkdir -p "$HOME/Maildir/.${i.name}/cur"
120
120
-
for mail in $(${pkgs.notmuch}/bin/notmuch search --output=files 'tag:inbox and (${
121
121
-
lib.concatMapStringsSep " or " (f: "${f}") i.value
122
122
-
})'); do
123
123
-
if test -e "$mail"; then
124
124
-
mv "$mail" "$HOME/Maildir/.${i.name}/cur/"
125
125
-
else
126
126
-
echo "$mail does not exist"
127
127
-
fi
128
128
-
done
129
129
-
${pkgs.notmuch}/bin/notmuch tag -inbox +${i.name} -- tag:inbox ${
130
130
-
lib.concatMapStringsSep " or " (f: "${f}") i.value
131
131
-
}
132
132
-
'') (lib.mapAttrsToList lib.nameValuePair mailboxes)}
133
133
-
${pkgs.notmuch}/bin/notmuch new
134
134
-
${pkgs.notmuch}/bin/notmuch dump > "$HOME/Maildir/notmuch.backup"
135
135
-
'';
136
136
-
137
137
-
tag-old-mails = pkgs.writeDashBin "nm-tag-old" ''
138
138
-
set -efux
139
139
-
${lib.concatMapStringsSep "\n" (i: ''
140
140
-
${pkgs.notmuch}/bin/notmuch tag -inbox -archive +${i.name} -- ${
141
141
-
lib.concatMapStringsSep " or " (f: "${f}") i.value
142
142
-
}
143
143
-
mkdir -p "$HOME/Maildir/.${i.name}/cur"
144
144
-
for mail in $(${pkgs.notmuch}/bin/notmuch search --output=files ${
145
145
-
lib.concatMapStringsSep " or " (f: "${f}") i.value
146
146
-
}); do
147
147
-
if test -e "$mail"; then
148
148
-
mv "$mail" "$HOME/Maildir/.${i.name}/cur/"
149
149
-
else
150
150
-
echo "$mail does not exist"
151
151
-
fi
152
152
-
done
153
153
-
'') (lib.mapAttrsToList lib.nameValuePair mailboxes)}
154
154
-
${pkgs.notmuch}/bin/notmuch new --no-hooks
155
155
-
'';
156
156
-
157
157
-
muttrc = pkgs.writeText "muttrc" ''
158
158
-
159
159
-
# read html mails
160
160
-
auto_view text/html
161
161
-
set mailcap_path = ${mailcap}
162
162
-
163
163
-
# notmuch
164
164
-
set folder="$HOME/Maildir"
165
165
-
set nm_default_uri = "notmuch://$HOME/Maildir"
166
166
-
set nm_record = yes
167
167
-
set nm_record_tags = "-inbox me archive"
168
168
-
set spoolfile = +Inbox
169
169
-
set virtual_spoolfile = yes
170
170
-
171
171
-
172
172
-
set sendmail="${msmtp}/bin/msmtp" # enables parsing of outgoing mail
173
173
-
set from="lassulus@lassul.us"
174
174
-
alternates ^.*@lassul\.us$ ^.*@.*\.r$
175
175
-
unset envelope_from_address
176
176
-
set use_envelope_from
177
177
-
set reverse_name
178
178
-
set markers=no
179
179
-
180
180
-
set sort=threads
181
181
-
182
182
-
set index_format="%4C %Z %?GI?%GI& ? %[%y-%m-%d] %-20.20a %?M?(%3M)& ? %s %> %r %g"
183
183
-
184
184
-
virtual-mailboxes "Unread" "notmuch://?query=tag:unread"
185
185
-
virtual-mailboxes "INBOX" "notmuch://?query=tag:inbox"
186
186
-
${lib.concatMapStringsSep "\n" (
187
187
-
i: ''${" "}virtual-mailboxes "${i.name}" "notmuch://?query=tag:${i.name}"''
188
188
-
) (lib.mapAttrsToList lib.nameValuePair mailboxes)}
189
189
-
virtual-mailboxes "TODO" "notmuch://?query=tag:TODO"
190
190
-
virtual-mailboxes "Starred" "notmuch://?query=tag:*"
191
191
-
virtual-mailboxes "Archive" "notmuch://?query=tag:archive"
192
192
-
virtual-mailboxes "Sent" "notmuch://?query=tag:sent"
193
193
-
virtual-mailboxes "Junk" "notmuch://?query=tag:junk"
194
194
-
virtual-mailboxes "All" "notmuch://?query=*"
195
195
-
196
196
-
tag-transforms "junk" "k" \
197
197
-
"unread" "u" \
198
198
-
"replied" "↻" \
199
199
-
"TODO" "T" \
200
200
-
201
201
-
# notmuch bindings
202
202
-
macro index \\\\ "<vfolder-from-query>" # looks up a hand made query
203
203
-
macro index + "<modify-labels>+*\n<sync-mailbox>" # tag as starred
204
204
-
macro index - "<modify-labels>-*\n<sync-mailbox>" # tag as unstarred
205
205
-
206
206
-
# muchsync
207
207
-
bind index \Cr noop
208
208
-
macro index \Cr \
209
209
-
"<enter-command>unset wait_key<enter> \
210
210
-
<shell-escape>mailsync<enter>
211
211
-
212
212
-
#killed
213
213
-
bind index d noop
214
214
-
bind pager d noop
215
215
-
216
216
-
bind index S noop
217
217
-
bind index s noop
218
218
-
bind pager S noop
219
219
-
bind pager s noop
220
220
-
macro index S "<modify-labels-then-hide>-inbox -unread +junk\n" # tag as Junk mail
221
221
-
macro index s "<modify-labels>-junk\n" # tag as Junk mail
222
222
-
macro pager S "<modify-labels-then-hide>-inbox -unread +junk\n" # tag as Junk mail
223
223
-
macro pager s "<modify-labels>-junk\n" # tag as Junk mail
224
224
-
225
225
-
226
226
-
bind index A noop
227
227
-
bind index a noop
228
228
-
bind pager A noop
229
229
-
bind pager a noop
230
230
-
macro index A "<modify-labels>+archive -unread -inbox\n" # tag as Archived
231
231
-
macro index a "<modify-labels>-archive\n" # tag as Archived
232
232
-
macro pager A "<modify-labels>+archive -unread -inbox\n" # tag as Archived
233
233
-
macro pager a "<modify-labels>-archive\n" # tag as Archived
234
234
-
235
235
-
236
236
-
bind index U noop
237
237
-
bind index u noop
238
238
-
bind pager U noop
239
239
-
bind pager u noop
240
240
-
macro index U "<modify-labels>+unread\n"
241
241
-
macro index u "<modify-labels>-unread\n"
242
242
-
macro pager U "<modify-labels>+unread\n"
243
243
-
macro pager u "<modify-labels>-unread\n"
244
244
-
245
245
-
246
246
-
bind index t noop
247
247
-
bind pager t noop
248
248
-
macro index t "<modify-labels>" # tag as Archived
249
249
-
250
250
-
# top index bar in email view
251
251
-
set pager_index_lines=7
252
252
-
# top_index_bar toggle
253
253
-
macro pager ,@1 "<enter-command> set pager_index_lines=0; macro pager ] ,@2 'Toggle indexbar<Enter>"
254
254
-
macro pager ,@2 "<enter-command> set pager_index_lines=3; macro pager ] ,@3 'Toggle indexbar<Enter>"
255
255
-
macro pager ,@3 "<enter-command> set pager_index_lines=7; macro pager ] ,@1 'Toggle indexbar<Enter>"
256
256
-
macro pager ] ,@1 'Toggle indexbar
257
257
-
258
258
-
259
259
-
# scan urls from emails
260
260
-
macro index,pager \cb "<pipe-message> ${lib.getExe pkgs.urlscan}<Enter>" "call urlscan to extract URLs out of a message"
261
261
-
macro attach,compose \cb "<pipe-entry> ${lib.getExe pkgs.urlscan}<Enter>" "call urlscan to extract URLs out of a message"
262
262
-
263
263
-
# sidebar
264
264
-
set sidebar_divider_char = '│'
265
265
-
set sidebar_delim_chars = "/"
266
266
-
set sidebar_short_path
267
267
-
set sidebar_folder_indent
268
268
-
set sidebar_visible = yes
269
269
-
set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?'
270
270
-
set sidebar_width = 20
271
271
-
color sidebar_new yellow red
272
272
-
273
273
-
# sidebar bindings
274
274
-
bind index <left> sidebar-prev # got to previous folder in sidebar
275
275
-
bind index <right> sidebar-next # got to next folder in sidebar
276
276
-
bind index <space> sidebar-open # open selected folder from sidebar
277
277
-
# sidebar toggle
278
278
-
macro index,pager ,@) "<enter-command> set sidebar_visible=no; macro index,pager [ ,@( 'Toggle sidebar'<Enter>"
279
279
-
macro index,pager ,@( "<enter-command> set sidebar_visible=yes; macro index,pager [ ,@) 'Toggle sidebar'<Enter>"
280
280
-
macro index,pager [ ,@( 'Toggle sidebar' # toggle the sidebar
281
281
-
282
282
-
# forward with attachment
283
283
-
# https://github.com/neomutt/neomutt/issues/1258#issuecomment-689522156
284
284
-
set mime_forward = no
285
285
-
set forward_attachments = yes
286
286
-
'';
287
287
-
288
288
-
mutt = pkgs.symlinkJoin {
289
289
-
name = "mutt";
290
290
-
paths = [
291
291
-
(pkgs.writeDashBin "mutt" ''
292
292
-
exec ${pkgs.neomutt}/bin/neomutt -F ${muttrc} "$@"
293
293
-
'')
294
294
-
pkgs.neomutt
295
295
-
];
296
296
-
};
297
297
-
298
298
-
in
1
1
+
{ self, pkgs, ... }:
299
2
{
300
300
-
environment.variables.NOTMUCH_CONFIG = toString notmuch-config;
301
3
environment.systemPackages = [
302
302
-
msmtp
303
303
-
mutt
304
304
-
pkgs.notmuch
305
305
-
pkgs.muchsync
306
306
-
tag-new-mails
307
307
-
tag-old-mails
308
308
-
(pkgs.writeShellApplication {
309
309
-
name = "mailsync";
310
310
-
meta.description = "sync mails with muchsync with green";
311
311
-
runtimeInputs = [ pkgs.muchsync ];
312
312
-
text = ''
313
313
-
if ping -W2 -c1 green.s; then
314
314
-
muchsync lass@green.s
315
315
-
elif ping -W2 -c1 green.n; then
316
316
-
muchsync lass@green.n
317
317
-
elif ping -W2 -c1 green.r; then
318
318
-
muchsync lass@green.r
319
319
-
else
320
320
-
echo no green host reachable
321
321
-
exit 1
322
322
-
fi
323
323
-
'';
324
324
-
})
4
4
+
self.packages.${pkgs.system}.mutt
325
5
];
326
6
}