aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/pass/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs/pass/default.nix')
-rw-r--r--modules/programs/pass/default.nix68
1 files changed, 26 insertions, 42 deletions
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
+ '';
};
}