summaryrefslogtreecommitdiff
path: root/modules/password-store.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/password-store.nix')
-rw-r--r--modules/password-store.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/password-store.nix b/modules/password-store.nix
new file mode 100644
index 0000000..e5cd756
--- /dev/null
+++ b/modules/password-store.nix
@@ -0,0 +1,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
+ '';
+ };
+ };
+}