aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile53
-rwxr-xr-xbin/m66
-rwxr-xr-xbin/mailcfg297
-rw-r--r--etc/git/config5
-rw-r--r--etc/guix/system.scm9
-rw-r--r--etc/remhind/config.tmpl4
-rw-r--r--etc/sh/rc1
7 files changed, 28 insertions, 407 deletions
diff --git a/Makefile b/Makefile
index 9907b46..304a780 100644
--- a/Makefile
+++ b/Makefile
@@ -14,22 +14,17 @@ lisp-images = \
derived-assets = \
$(pod2man) \
$(XDG_CONFIG_HOME)/ssh/id_rsa.pub \
- $(XDG_CONFIG_HOME)/git/config-extra \
$(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf \
- $(XDG_CONFIG_HOME)/remhind/config \
$(XDG_CONFIG_HOME)/ssh/config \
- $(XDG_CONFIG_HOME)/alot/config \
- $(XDG_CONFIG_HOME)/mbsync/config \
- $(XDG_CONFIG_HOME)/msmtp/config \
- $(XDG_CONFIG_HOME)/notmuch/default/config \
- $(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new \
- $(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt \
$(XDG_DATA_HOME)/common-lisp/source \
$(XDG_DATA_HOME)/euandreh/e.list.txt \
+ $(PRIV_STATEDIR)/postfix/relayhosts-maps.db \
+ $(PRIV_STATEDIR)/postfix/sasl-password.db \
$(lisp-images)
all: $(derived-assets)
+ cd $(PRIV_CONFIG) && $(MAKE) $@
share/man/man1/x.1: bin/x
@@ -41,39 +36,13 @@ share/man/man1/z.1: bin/z
$(XDG_DATA_HOME)/common-lisp/source:
ln -s $(SRC)/libre $@
-$(XDG_CONFIG_HOME)/alot/config: bin/mailcfg
- mailcfg alot > $@
-
-$(XDG_CONFIG_HOME)/mbsync/config: bin/mailcfg
- mailcfg mbsync > $@
-
-$(XDG_CONFIG_HOME)/msmtp/config: bin/mailcfg
- mailcfg msmtp > $@
-
-$(XDG_CONFIG_HOME)/notmuch/default/config: bin/mailcfg
- mailcfg notmuchcfg > $@
-
-$(XDG_CONFIG_HOME)/notmuch/default/hooks/post-new: bin/mailcfg
- mailcfg notmuchhook > $@
- chmod +x $@
-
-$(XDG_DATA_HOME)/euandreh/mailcfg-accounts.txt: bin/mailcfg
- mailcfg list > $@
-
$(XDG_CONFIG_HOME)/ssh/id_rsa.pub:
gpg --export-ssh-key eu@euandre.org > $@
chmod 600 $@
-$(XDG_CONFIG_HOME)/remhind/config: $(XDG_CONFIG_HOME)/remhind/config.tmpl
- envsubst < $(XDG_CONFIG_HOME)/remhind/config.tmpl > $@
-
$(XDG_CONFIG_HOME)/ssh/config: $(XDG_CONFIG_HOME)/ssh/config.tmpl
envsubst < $(XDG_CONFIG_HOME)/ssh/config.tmpl > $@
-$(XDG_CONFIG_HOME)/git/config-extra:
- printf '[sendemail]\n smtpserver = ' > $@
- command -v msmtpq >> $@
-
$(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf: $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf.tmpl
cp $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf.tmpl $@
printf 'pinentry-program ' >> $@
@@ -82,6 +51,12 @@ $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf: $(XDG_CONFIG_HOME)/gnupg/gpg-agent.conf
$(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh
sh opt/aux/gen-e-list.sh > $@
+$(PRIV_STATEDIR)/postfix/relayhosts-maps.db $(PRIV_STATEDIR)/postfix/sasl-password.db:
+ postmap $(@D)/`basename $@ .db`
+
+$(PRIV_STATEDIR)/postfix/sasl-password.db: $(PRIV_STATEDIR)/postfix/sasl-password
+$(PRIV_STATEDIR)/postfix/relayhosts-maps.db: $(PRIV_STATEDIR)/postfix/relayhosts-maps
+
$(lisp-images): $(XDG_CONFIG_HOME)/lisp-cli/init.lisp bin/cl bin/li
I=`echo $@ | awk -F/ '$$0=$$(NF)' | cut -d. -f1` && \
li -vI $$I -E "(format t \"Image for \\\"$$I\\\" created.~%\")"
@@ -135,8 +110,14 @@ check-sync:
exit 1; \
fi
-check: check-shellcheck check-perlcritic check-fixme check-dirty-public \
- check-dirty-private check-opt check-pod check-sync
+check-services:
+ # LANG=en_US.UTF-8 herd status poweralertd | awk 'NR == 2 { if ($0 != " It is started.") { print "poweralertd not running."; exit 1 } }'
+
+check: check-shellcheck check-perlcritic check-fixme check-dirty-public \
+ check-dirty-private check-opt check-pod check-sync \
+ check-services \
+ cd $(PRIV_CONFIG) && $(MAKE) $@
clean:
rm -f $(derived-assets)
+ cd $(PRIV_CONFIG) && $(MAKE) $@
diff --git a/bin/m b/bin/m
deleted file mode 100755
index 6891128..0000000
--- a/bin/m
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-set -eu
-
-usage() {
- cat <<-'EOF'
- Usage:
- m
- m -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
- Options:
- -h, --help show this message
-
-
- Fetch email via IMAP and update the notmuch index.
-
-
- Examples:
-
- Just fetch email
-
- $ m
- EOF
-}
-
-
-for flag in "$@"; do
- case "$flag" in
- --)
- break
- ;;
- --help)
- usage
- help
- exit
- ;;
- *)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- h)
- usage
- help
- exit
- ;;
- *)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-
-F="${XDG_DATA_HOME:-$HOME/.local/share}"/euandreh/mailcfg-accounts.txt
-
-notmuch new
-xargs -I% -P "$(wc -l < "$F")" mbsync '%' < "$F"
-notmuch new
diff --git a/bin/mailcfg b/bin/mailcfg
deleted file mode 100755
index f77355e..0000000
--- a/bin/mailcfg
+++ /dev/null
@@ -1,297 +0,0 @@
-#!/bin/sh
-# shellcheck disable=1090,2153
-set -eu
-
-usage() {
- cat <<-'EOF'
- Usage:
- mailcfg ACTION
- mailcfg -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
- Options:
- -h, --help show this message
-
- ACTION one of:
- - mbsync
- - msmtp
- - notmuchcfg
- - notmuchhook
- - alot
- - list
-
-
- Emit the generated configuration file for the chosen email
- program. Get the configuration files from
- $XDG_CONFIG_HOME/mailcfg/*.env, where every *.env file is a
- shell script that defines the variables used in this program:
- - $NAME
- - $LABEL
- - $IMAP
- - $SMTP
- - $ADDR
-
- One of the files also needs to define:
- - $DEFAULT_NAME
- - $DEFAULT_ADDR
- - $DEFAULT_LABEL
-
- An example of such file could be "30-andre@work.com.env":
-
- #!/bin/sh
- set -eu
-
-
- NAME='André!'
- LABEL='Work'
- IMAP='imap.work.com'
- SMTP='smtp.work.com'
- ADDR='andre@work.com'
-
-
- Examples:
-
- Get the alot configuration file:
-
- $ mailcfg alot
-
-
- List the existing account labels:
-
- $ mailcfg list
- EOF
-}
-
-
-for flag; do
- case "$flag" in
- --)
- break
- ;;
- --help)
- usage
- help
- exit
- ;;
- *)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- h)
- usage
- help
- exit
- ;;
- *)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-ACTION="${1:-}"
-eval "$(assert-arg "$ACTION" 'ACTION')"
-
-CFGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/mailcfg"
-
-
-mbsync() {
- cat <<-'EOF'
- SyncState *
- Create Both
- Expunge Both
- Remove Both
- Sync All
- EOF
-
- for env in "$CFGDIR"/*.env; do
- . "$env"
- cat <<-EOF
-
-
- ## $LABEL
-
- IMAPAccount $LABEL
- Host $IMAP
- User $ADDR
- PassCmd "pass show $ADDR"
- SSLType IMAPS
-
- IMAPStore ${LABEL}Remote
- Account $LABEL
-
- MaildirStore ${LABEL}Local
- Path ~/Maildir/$LABEL/
- Inbox ~/Maildir/$LABEL/INBOX
- SubFolders Verbatim
-
- Channel ${LABEL}Folders
- Far :${LABEL}Remote:
- Near :${LABEL}Local:
- Patterns *
-
- Group $LABEL
- Channel ${LABEL}Folders
- EOF
- done
-}
-
-msmtp() {
- cat <<-EOF
- defaults
- auth on
- tls on
- port 587
- syslog on
- logfile $XDG_LOG_HOME/msmtp.log
- EOF
-
- for env in "$CFGDIR"/*.env; do
- . "$env"
- cat <<-EOF
-
- account $LABEL
- host $SMTP
- from $ADDR
- user $ADDR
- passwordeval pass show $ADDR
- EOF
- done
-
- cat <<-EOF
-
- account default : $DEFAULT_LABEL
- EOF
-}
-
-notmuchcfg() {
- for env in "$CFGDIR"/*.env; do
- . "$env"
- done
-
- cat <<-EOF
- [user]
- name = $DEFAULT_NAME
- primary_email = $DEFAULT_ADDR
- EOF
-
- printf 'other_email = '
- for env in "$CFGDIR"/*.env; do
- . "$env"
- if [ "$ADDR" = "$DEFAULT_ADDR" ]; then
- continue
- fi
- echo "$ADDR"
- done | paste -sd';'
-
- cat <<-'EOF'
-
- [new]
- tags = new;
- ignore = .mbsyncstate;.uidvalidity
-
- [search]
- exclude_tags = deleted;spam
-
- [maildir]
- synchronize_flags = true
- EOF
-}
-
-notmuchhook() {
- LABELS=''
- for env in "$CFGDIR"/*.env; do
- . "$env"
- if [ -z "$LABELS" ]; then
- LABELS="$LABEL"
- else
- LABELS="$LABELS $LABEL"
- fi
- done
- sed \
- -e "s|@DIRS@|$LABELS|g" \
- -e "s|@DEFAULT_LABEL@|$DEFAULT_LABEL|g" \
- "$CFGDIR"/post-new
-}
-
-alot() {
- cat <<-'EOF'
- attachment_prefix = "~/Downloads/"
-
- [bindings]
- i = toggletags inbox
- I = search folder:/INBOX/ AND NOT tag:killed AND NOT tag:archive
- EOF
- echo "
- z archive
- s spam
- u unread
- r keep
- t track
- " | while read -r l; do
- if [ -z "$l" ]; then
- continue
- fi
- LC="$( echo "$l" | cut -d' ' -f1)"
- TAG="$(echo "$l" | cut -d' ' -f2)"
- UC="$(echo "$LC" | tr '[:lower:]' '[:upper:]')"
- cat <<-EOF
- $LC = toggletags $TAG
- $UC = search tag:$TAG AND NOT tag:killed
- EOF
- done
-
- cat <<-'EOF'
- M = search folder:/lists/ AND NOT tag:killed
- m = compose --tags inbox
- [[thread]]
- v = pipeto urlscan 2>/dev/null
- V = pipeto 'gpg -d | less'
- r = reply --all
- R = reply
- ' ' = fold; untag unread; move next unfolded
- P = pipeto 'git am'
-
- [accounts]
- EOF
-
- for env in "$CFGDIR"/*.env; do
- . "$env"
- cat <<-EOF
- [[$LABEL]]
- realname = $NAME
- address = $ADDR
- sendmail_command = msmtpq --account=$LABEL -t
- sent_box = maildir://~/Maildir/$LABEL/Sent
- draft_box = maildir://~/Maildir/$LABEL/Drafts
- gpg_key = 5BDAE9B8B2F6C6BCBB0D6CE581F90EC3CD356060
- EOF
- done
-}
-
-list() {
- for env in "$CFGDIR"/*.env; do
- . "$env"
- printf '%s\n' "$LABEL"
- done
-}
-
-
-case "$ACTION" in
- mbsync|msmtp|notmuchcfg|notmuchhook|alot|list)
- "$1"
- ;;
- *)
- printf 'Unsupported ACTION: "%s".\n\n' "$ACTION" >&2
- usage >&2
- exit 2
- ;;
-esac
diff --git a/etc/git/config b/etc/git/config
index 0ff1257..81fcd41 100644
--- a/etc/git/config
+++ b/etc/git/config
@@ -12,14 +12,11 @@
[init]
defaultBranch = main
[sendemail]
+ envelopeSender = eu@euandre.org
assume8bitEncoding = UTF-8
- smtpserveroption = -a
- smtpserveroption = EuAndreh
annotate = yes
confirm = never
[remote "origin"]
fetch = +refs/notes/*:refs/notes/*
[format]
useAutoBase = whenAble
-[include]
- path = config-extra
diff --git a/etc/guix/system.scm b/etc/guix/system.scm
index ce8db71..943f63d 100644
--- a/etc/guix/system.scm
+++ b/etc/guix/system.scm
@@ -97,6 +97,15 @@
(service enlightenment-desktop-service-type)
(service gnome-desktop-service-type)
(service gnome-keyring-service-type)
+ (simple-service 'create-/var/lib/euandreh activation-service-type
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((user (getpwnam #$whoami)))
+ (format (current-error-port)
+ "Creating system-level private state directory: \"~a\".~%" #$priv-statedir)
+ (mkdir-p #$priv-statedir)
+ (chown #$priv-statedir (passwd:uid user) (passwd:gid user))
+ (chmod #$priv-statedir #o700))))
(service mail-aliases-service-type
`(("root" ,whoami)))
(service wireguard-service-type
diff --git a/etc/remhind/config.tmpl b/etc/remhind/config.tmpl
deleted file mode 100644
index 4d74b20..0000000
--- a/etc/remhind/config.tmpl
+++ /dev/null
@@ -1,4 +0,0 @@
-[calendars]
- [calendars.private_cal]
- name = "private_cal"
- path = "${XDG_DATA_HOME}/khal/calendars/private/"
diff --git a/etc/sh/rc b/etc/sh/rc
index ae552a6..4a79482 100644
--- a/etc/sh/rc
+++ b/etc/sh/rc
@@ -42,6 +42,7 @@ export HISTSIZE=-1
export HISTFILE="$XDG_STATE_HOME/sh-history"
export SRC=~/dev
export PRIV_CONFIG="$XDG_PREFIX"/var/lib/private/tilde
+export PRIV_STATEDIR=/var/lib/"$USER"
export EDITOR='e'
export VISUAL="$EDITOR"
export PAGER='less -R'