diff options
| -rw-r--r-- | modules/programs/aerc/default.nix | 2 | ||||
| -rw-r--r-- | modules/programs/git/default.nix | 12 | ||||
| -rw-r--r-- | modules/programs/gpg/default.nix | 1 | ||||
| -rw-r--r-- | modules/programs/pass/default.nix | 68 | ||||
| -rw-r--r-- | modules/scripts/aerc-mail-setup.sh | 1 | ||||
| -rw-r--r-- | modules/scripts/aerc-sync-mail.sh | 1 |
6 files changed, 34 insertions, 51 deletions
diff --git a/modules/programs/aerc/default.nix b/modules/programs/aerc/default.nix index 92b1cd6..7c69999 100644 --- a/modules/programs/aerc/default.nix +++ b/modules/programs/aerc/default.nix @@ -1,8 +1,10 @@ +# aerc - Terminal email client { config, lib, ... }: + { config = lib.mkIf config.programs.aerc.enable { programs.aerc = { diff --git a/modules/programs/git/default.nix b/modules/programs/git/default.nix index cfba093..bd91511 100644 --- a/modules/programs/git/default.nix +++ b/modules/programs/git/default.nix @@ -6,10 +6,6 @@ }: # Git - Distributed version control system -let - passCfg = config.programs.pass; - passGitHelper = lib.getExe pkgs.pass-git-helper; -in { options.programs.git = { username = lib.mkOption { @@ -23,6 +19,8 @@ in }; config = lib.mkIf config.programs.git.enable { + home.packages = lib.mkIfconfig config.programs.pass.enable [ pkgs.pass-git-helper ]; + programs.git = { settings = lib.recursiveUpdate @@ -34,10 +32,10 @@ in core.askPass = ""; } ( - lib.optionalAttrs passCfg.enable { + lib.optionalAttrs config.programs.pass.enable { credential."https://github.com" = { - username = passCfg.github.username; - helper = passGitHelper; + username = config.programs.pass.github.username; + helper = lib.getExe pkgs.pass-git-helper; }; } ); diff --git a/modules/programs/gpg/default.nix b/modules/programs/gpg/default.nix index f6bce6e..9e2da2c 100644 --- a/modules/programs/gpg/default.nix +++ b/modules/programs/gpg/default.nix @@ -1,3 +1,4 @@ +# gpg - GNU Privacy Guard { config, lib, diff --git a/modules/programs/pass/default.nix b/modules/programs/pass/default.nix index 0d11ab7..d5067b9 100644 --- a/modules/programs/pass/default.nix +++ b/modules/programs/pass/default.nix @@ -1,36 +1,14 @@ +# pass - Standard Unix password manager { 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"; + enable = lib.mkEnableOption "Enables pass."; package = lib.mkPackageOption pkgs "pass" { }; @@ -39,31 +17,37 @@ in 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 { + config = lib.mkIf config.program.pass.enable { programs.password-store = { enable = true; - package = cfg.package; + package = config.program.pass.package; settings = { - PASSWORD_STORE_DIR = cfg.storeDir; + PASSWORD_STORE_DIR = config.program.pass.storeDir; }; }; - home.file.".config/pass-git-helper/git-pass-mapping.ini".text = githubMapping; + home.file.".config/pass-git-helper/git-pass-mapping.ini".text = '' + [github.com] + target = github/token + username = ${config.program.pass.github.username} + username_extractor = static + + [github.com/*] + target = github/token + username = ${config.program.pass.github.username} + username_extractor = static + + [*.github.com] + target = github/token + username = ${config.program.pass.github.username} + username_extractor = static + + [*.github.com/*] + target = github/token + username = ${config.program.pass.github.username} + username_extractor = static + ''; }; } diff --git a/modules/scripts/aerc-mail-setup.sh b/modules/scripts/aerc-mail-setup.sh index e1e2448..cca982e 100644 --- a/modules/scripts/aerc-mail-setup.sh +++ b/modules/scripts/aerc-mail-setup.sh @@ -1,4 +1,3 @@ -#!/usr/bin/env bash set -euo pipefail config_home="${XDG_CONFIG_HOME:-$HOME/.config}" diff --git a/modules/scripts/aerc-sync-mail.sh b/modules/scripts/aerc-sync-mail.sh index 0a69346..7e45cdf 100644 --- a/modules/scripts/aerc-sync-mail.sh +++ b/modules/scripts/aerc-sync-mail.sh @@ -1,4 +1,3 @@ -#!/usr/bin/env bash set -euo pipefail target="${1:--a}" |
