blob: 0d11ab7f8af1e5b6693a33b7b8888bbdc14b32d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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;
};
}
|