aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/pass/default.nix
blob: d5067b9f347c7d3fabdb7dcd1d36d2dbe079b907 (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
# pass - Standard Unix password manager
{
  config,
  lib,
  pkgs,
  ...
}:

{
  options.programs.pass = {
    enable = lib.mkEnableOption "Enables pass.";

    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.";
    };
  };

  config = lib.mkIf config.program.pass.enable {
    programs.password-store = {
      enable = true;
      package = config.program.pass.package;
      settings = {
        PASSWORD_STORE_DIR = config.program.pass.storeDir;
      };
    };

    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
    '';
  };
}