From 6941090be12bb5eae7edd76ec19c255536802493 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Thu, 9 Jul 2026 00:20:13 +0530 Subject: refactor: made some minor changes --- modules/programs/pass/default.nix | 68 +++++++++++++++------------------------ 1 file changed, 26 insertions(+), 42 deletions(-) (limited to 'modules/programs/pass/default.nix') 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 + ''; }; } -- cgit v1.2.3