about summary refs log tree commit diff
path: root/modules/password-store.nix
blob: e5cd756dae9f96723fd9bbf4bb1819531527dd12 (plain) (blame)
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
{
  config,
  lib,
  pkgs,
  ...
}:
with lib;
let
  cfg = config.nixfiles.modules.password-store;
in
{
  options.nixfiles.modules.password-store.enable = mkEnableOption "the standard UNIX password manager";

  config = mkIf cfg.enable {
    hm.programs = {
      password-store = {
        enable = true;

        package = pkgs.pass.withExtensions (p: with p; [ pass-otp ]);

        settings.PASSWORD_STORE_DIR = "${config.my.home}/.password-store";
      };

      # HACK https://github.com/NixOS/nixpkgs/issues/183604
      bash.initExtra =
        let
          completions = "${config.hm.programs.password-store.package}/share/bash-completion/completions";
        in
        mkAfter ''
          source ${completions}/pass-otp
          source ${completions}/pass
        '';
    };
  };
}

Consider giving Nix/NixOS a try! <3