aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/aerc/default.nix54
-rw-r--r--modules/programs/default.nix4
-rw-r--r--modules/programs/git/default.nix41
-rw-r--r--modules/programs/gpg/default.nix18
-rw-r--r--modules/programs/less/default.nix15
-rw-r--r--modules/programs/pass/default.nix69
-rw-r--r--modules/programs/zsh/default.nix3
7 files changed, 190 insertions, 14 deletions
diff --git a/modules/programs/aerc/default.nix b/modules/programs/aerc/default.nix
new file mode 100644
index 0000000..92b1cd6
--- /dev/null
+++ b/modules/programs/aerc/default.nix
@@ -0,0 +1,54 @@
+{
+ config,
+ lib,
+ ...
+}:
+{
+ 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;
+ };
+
+ filters = ''
+ text/plain = wrap -w 100 | colorize
+ text/html = ! html
+ text/* = ${lib.getExe config.programs.bat.package} -fP --file-name="''${AERC_FILENAME:-message.txt}" --style=plain
+ message/delivery-status = colorize
+ .headers = colorize
+ '';
+
+ 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 5f6b49a..ed54f24 100644
--- a/modules/programs/default.nix
+++ b/modules/programs/default.nix
@@ -3,6 +3,7 @@
# Tools - Collection of tool configurations (browsers, editors, utilities, etc.)
{
imports = [
+ ./aerc
./aria2
./bat
./bluetui
@@ -15,10 +16,12 @@
./ffmpeg
./fzf
./git
+ ./gpg
./heroic
./htop
./impala
./kitty
+ ./less
./lf
./lsd
./maim
@@ -29,6 +32,7 @@
./openvpn
./ouch
./pamixer
+ ./pass
./playerctl
./qemu
./slop
diff --git a/modules/programs/git/default.nix b/modules/programs/git/default.nix
index 24d63c7..cfba093 100644
--- a/modules/programs/git/default.nix
+++ b/modules/programs/git/default.nix
@@ -1,6 +1,15 @@
-{ lib, config, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
# Git - Distributed version control system
+let
+ passCfg = config.programs.pass;
+ passGitHelper = lib.getExe pkgs.pass-git-helper;
+in
{
options.programs.git = {
username = lib.mkOption {
@@ -15,19 +24,23 @@
config = lib.mkIf config.programs.git.enable {
programs.git = {
- settings = {
- user = {
- name = config.programs.git.username;
- email = config.programs.git.email;
- };
- credential.helper = "store --file ${config.xdg.cacheHome}/git/credential";
- core.askPass = "";
- };
+ settings =
+ lib.recursiveUpdate
+ {
+ user = {
+ name = config.programs.git.username;
+ email = config.programs.git.email;
+ };
+ core.askPass = "";
+ }
+ (
+ lib.optionalAttrs passCfg.enable {
+ credential."https://github.com" = {
+ username = passCfg.github.username;
+ helper = passGitHelper;
+ };
+ }
+ );
};
-
- # The base directory of the credential file must exist
- home.activation.createGitCacheDirectory = lib.hm.dag.entryAfter [
- "writeBoundary"
- ] "mkdir -p ${config.xdg.cacheHome}/git";
};
}
diff --git a/modules/programs/gpg/default.nix b/modules/programs/gpg/default.nix
new file mode 100644
index 0000000..f6bce6e
--- /dev/null
+++ b/modules/programs/gpg/default.nix
@@ -0,0 +1,18 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+
+{
+ config = lib.mkIf config.programs.gpg.enable {
+ services.gpg-agent = {
+ enable = true;
+ enableZshIntegration = true;
+ defaultCacheTtl = 3600;
+ maxCacheTtl = 86400;
+ pinentry.package = pkgs.pinentry-gtk2;
+ };
+ };
+}
diff --git a/modules/programs/less/default.nix b/modules/programs/less/default.nix
new file mode 100644
index 0000000..516377d
--- /dev/null
+++ b/modules/programs/less/default.nix
@@ -0,0 +1,15 @@
+{ config, lib, ... }:
+
+# less - terminal pager
+{
+ config = lib.mkIf config.programs.less.enable {
+ programs.less = {
+ options = [
+ "--RAW-CONTROL-CHARS"
+ "--quit-if-one-screen"
+ "--no-init"
+ "--ignore-case"
+ ];
+ };
+ };
+}
diff --git a/modules/programs/pass/default.nix b/modules/programs/pass/default.nix
new file mode 100644
index 0000000..0d11ab7
--- /dev/null
+++ b/modules/programs/pass/default.nix
@@ -0,0 +1,69 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+let
+ cfg = config.programs.pass;
+ githubMapping = ''
+ [github.com]
+ target = github/token
+ username = ${cfg.github.username}
+ username_extractor = static
+
+ [github.com/*]
+ target = github/token
+ username = ${cfg.github.username}
+ username_extractor = static
+
+ [*.github.com]
+ target = github/token
+ username = ${cfg.github.username}
+ username_extractor = static
+
+ [*.github.com/*]
+ target = github/token
+ username = ${cfg.github.username}
+ username_extractor = static
+ '';
+in
+{
+ options.programs.pass = {
+ enable = lib.mkEnableOption "pass password manager";
+
+ package = lib.mkPackageOption pkgs "pass" { };
+
+ storeDir = lib.mkOption {
+ type = lib.types.str;
+ default = "${config.home.homeDirectory}/.password-store";
+ description = "Path to the pass password store.";
+ };
+
+ github = {
+ username = lib.mkOption {
+ type = lib.types.str;
+ default = "x-access-token";
+ description = "Username returned to Git for GitHub HTTPS credentials.";
+ };
+
+ tokenEntry = lib.mkOption {
+ type = lib.types.str;
+ default = "github/token";
+ description = "Pass entry containing the GitHub token on its first line.";
+ };
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ programs.password-store = {
+ enable = true;
+ package = cfg.package;
+ settings = {
+ PASSWORD_STORE_DIR = cfg.storeDir;
+ };
+ };
+
+ home.file.".config/pass-git-helper/git-pass-mapping.ini".text = githubMapping;
+ };
+}
diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix
index 482c201..f3bdbb1 100644
--- a/modules/programs/zsh/default.nix
+++ b/modules/programs/zsh/default.nix
@@ -22,6 +22,9 @@
autoload -U colors && colors
+ export GPG_TTY="$(tty)"
+ gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1
+
bindkey "^[[3~" delete-char
bindkey "^?" backward-delete-char
${nixCommandWrappers}