aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/aerc/assertions.nix19
-rw-r--r--modules/programs/aerc/default.nix58
-rw-r--r--modules/programs/default.nix3
-rw-r--r--modules/programs/email/default.nix53
-rw-r--r--modules/programs/git/default.nix23
-rw-r--r--modules/programs/meli/assertions.nix27
-rw-r--r--modules/programs/meli/default.nix46
7 files changed, 148 insertions, 81 deletions
diff --git a/modules/programs/aerc/assertions.nix b/modules/programs/aerc/assertions.nix
deleted file mode 100644
index a2b49c1..0000000
--- a/modules/programs/aerc/assertions.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ config, ... }:
-{
- assertions = [
- {
- assertion = !config.programs.aerc.enable || config.programs.less.enable;
- message = ''
- programs.aerc is enabled but programs.less.enable is not.
- aerc requires less as its pager. Please enable programs.less.
- '';
- }
- {
- assertion = !config.programs.aerc.enable || config.programs.bat.enable;
- message = ''
- programs.aerc is enabled but programs.bat.enable is not.
- aerc requires bat for text/html filtering. Please enable programs.bat.
- '';
- }
- ];
-}
diff --git a/modules/programs/aerc/default.nix b/modules/programs/aerc/default.nix
deleted file mode 100644
index 5b4ce78..0000000
--- a/modules/programs/aerc/default.nix
+++ /dev/null
@@ -1,58 +0,0 @@
-# aerc - Terminal email client
-{
- config,
- lib,
- ...
-}:
-
-{
- imports = [ ./assertions.nix ];
-
- config = lib.mkIf config.programs.aerc.enable {
- programs.aerc = {
- extraConfig = {
- general = {
- unsafe-accounts-conf = false;
- default-save-path = "${config.home.homeDirectory}/Downloads";
- use-terminal-pinentry = false;
- };
-
- ui = {
- index-columns = "flags:4,name<32%,subject,date>=";
- column-name = "{{with index .From 0}}{{.Address}}{{if .Name}} ({{.Name}}){{end}}{{end}}";
- timestamp-format = "2006-01-02 15:04";
- this-day-time-format = "15:04";
- this-week-time-format = "Mon 15:04";
- sidebar-width = 24;
- };
-
- viewer = {
- pager = lib.getExe config.programs.less.package;
- show-headers = true;
- };
-
- filters = ''
- text/plain = fold -w 100 -s
- text/html = fold -w 100 -s
- text/* = fold -w 100 -s
- message/delivery-status = fold -w 100 -s
- '';
-
- hooks = {
- mail-added = "aerc-sync-mail \"$AERC_ACCOUNT\"";
- mail-deleted = "aerc-sync-mail \"$AERC_ACCOUNT\"";
- flag-changed = "aerc-sync-mail \"$AERC_ACCOUNT\"";
- };
- };
- };
-
- home.file.".config/aerc/notmuch-query-map".text = ''
- Inbox=tag:inbox and not tag:deleted
- Unread=tag:unread and not tag:deleted
- Flagged=tag:flagged and not tag:deleted
- Sent=folder:sent or folder:Sent or folder:"[Gmail]/Sent Mail"
- Archive=not tag:inbox and not tag:deleted
- All=*
- '';
- };
-}
diff --git a/modules/programs/default.nix b/modules/programs/default.nix
index b1f620b..1527087 100644
--- a/modules/programs/default.nix
+++ b/modules/programs/default.nix
@@ -3,7 +3,6 @@
# Tools - Collection of tool configurations (browsers, editors, utilities, etc.)
{
imports = [
- ./aerc
./aria2
./bat
./bluetui
@@ -25,6 +24,7 @@
./lf
./lsd
./maim
+ ./meli
./nixvim
./nvtop
./opencode
@@ -33,6 +33,7 @@
./ouch
./pamixer
./gopass
+ ./email
./playerctl
./qemu
./slop
diff --git a/modules/programs/email/default.nix b/modules/programs/email/default.nix
new file mode 100644
index 0000000..36dfc95
--- /dev/null
+++ b/modules/programs/email/default.nix
@@ -0,0 +1,53 @@
+# email - Mbsync and notmuch mail synchronization
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+
+let
+ mailDir = "${config.home.homeDirectory}/.local/mail";
+in
+{
+ options.programs.email = {
+ enable = lib.mkEnableOption "Email suite (mbsync + notmuch)";
+ };
+
+ config = lib.mkIf config.programs.email.enable {
+ home.packages = [
+ pkgs.mbsync
+ pkgs.notmuch
+ ];
+
+ home.sessionVariables = {
+ MAILDIR = mailDir;
+ NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/notmuchrc";
+ };
+
+ xdg.configFile."notmuch/notmuch.config" = {
+ text = ''
+ [database]
+ path=${mailDir}/.notmuch
+
+ [user]
+ name=
+ address=
+ primary_key=
+
+ [new]
+ tags=unclassified;new;
+ ignore=
+
+ [search]
+ exclude_tags=deleted;spam;
+
+ [maildir]
+ synchronize_flags=true
+
+ [crypto]
+ gpg_path=${pkgs.gnupg}/bin/gpg
+ '';
+ };
+ };
+}
diff --git a/modules/programs/git/default.nix b/modules/programs/git/default.nix
index 133c063..91498b0 100644
--- a/modules/programs/git/default.nix
+++ b/modules/programs/git/default.nix
@@ -20,14 +20,24 @@
};
useSSH = lib.mkEnableOption "Use SSH instead of HTTPS for common git platforms.";
+
+ signing = {
+ key = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ description = "GPG signing key ID.";
+ };
+ signByDefault = lib.mkEnableOption "Sign commits by default";
+ };
};
config = lib.mkIf config.programs.git.enable {
programs.git = {
includes = [
- # An additional config file for global git settings but for more
- # private/non-portable configuration options like GPG keys
- { path = "${config.xdg.configHome}/git/personal"; }
+ {
+ path = "${config.xdg.configHome}/git/personal";
+ condition = "hasconfig:remote.*.url:git@*";
+ }
];
settings =
lib.recursiveUpdate
@@ -47,6 +57,13 @@
url."git@git.sr.ht:".insteadOf = "https://git.sr.ht/";
}
);
+ extraConfig = {
+ user.signingKey = lib.mkIf (
+ config.programs.git.signing.key != null
+ ) config.programs.git.signing.key;
+ commit.gpgSign = config.programs.git.signing.signByDefault;
+ tag.forceSignAnnotated = config.programs.git.signing.signByDefault;
+ };
};
};
}
diff --git a/modules/programs/meli/assertions.nix b/modules/programs/meli/assertions.nix
new file mode 100644
index 0000000..d651047
--- /dev/null
+++ b/modules/programs/meli/assertions.nix
@@ -0,0 +1,27 @@
+{ config, ... }:
+
+{
+ assertions = [
+ {
+ assertion = !config.programs.meli.enable || config.programs.less.enable;
+ message = ''
+ programs.meli is enabled but programs.less.enable is not.
+ meli requires less as its pager. Please enable programs.less.
+ '';
+ }
+ {
+ assertion = !config.programs.meli.enable || config.programs.bat.enable;
+ message = ''
+ programs.meli is enabled but programs.bat.enable is not.
+ meli requires bat for text/html filtering. Please enable programs.bat.
+ '';
+ }
+ {
+ assertion = !config.programs.meli.enable || config.programs.email.enable;
+ message = ''
+ programs.meli is enabled but programs.email.enable is not.
+ meli requires the email module (mbsync + notmuch) to be enabled.
+ '';
+ }
+ ];
+}
diff --git a/modules/programs/meli/default.nix b/modules/programs/meli/default.nix
new file mode 100644
index 0000000..d17a3db
--- /dev/null
+++ b/modules/programs/meli/default.nix
@@ -0,0 +1,46 @@
+# meli - Terminal email client
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+
+let
+ mailDir = "${config.home.homeDirectory}/.local/mail";
+in
+{
+ imports = [ ./assertions.nix ];
+
+ config = lib.mkIf config.programs.meli.enable {
+ home.packages = [ pkgs.meli ];
+
+ xdg.configFile."meli/config.toml" = {
+ text = ''
+ [terminal]
+ themes = "dark"
+
+ [notifications]
+ enable = false
+
+ [pager]
+ html_filter = "${pkgs.bat}/bin/bat --language=html"
+
+ [composing]
+ editor_command = "${pkgs.neovim}/bin/nvim"
+
+ [pgp]
+ auto_verify_signatures = true
+ gpg_binary = "${pkgs.gnupg}/bin/gpg"
+
+ [search]
+ backend = "notmuch"
+ database_path = "${mailDir}/.notmuch"
+ '';
+ };
+
+ programs.zsh.initExtra = lib.mkAfter ''
+ alias meli='meli-sync && meli'
+ '';
+ };
+}