Unable to Use `pass otp` or `pass import` with pass Installed via Home-Manager

Hello there,

I’ve recently installed pass using Home-Manager with some additional extensions, but I’m encountering an issue where I can’t use the pass otp or pass import commands. Here’s the relevant section of my Home-Manager configuration:

{
  pkgs,
  config,
  lib,
  ...
}: let
  storePath = "${config.home.homeDirectory}/.password-store";
in {
  programs.password-store = {
    enable = true;
    package = pkgs.pass-wayland.withExtensions (exts:
      with exts; [
        pass-otp
        pass-import
        pass-audit
      ]);
    settings.PASSWORD_STORE_DIR = storePath;
  };

  services.pass-secret-service = {
    inherit storePath;
    enable = true;
  };

  home.packages = with pkgs; [
    tessen
  ];
}

And I get the following error when trying to run one of them:

❯ pass otp
Error: otp is not in the password store.

Thanks in advance!

I would try to go over some assumptions. For one, I would ask pass what it thinks the path to my password store is.

The passwords get stored in ~/.password-store as they should

I did this with nixpkgs-unstable:

nix-repl> :b legacyPackages.x86_64-linux.pass.withExtensions (p: [p.pass-otp])

This derivation produced the following outputs:
  out -> /nix/store/blb6ih6qrh58i9kkig3gjgkla4pddpzn-pass-env
$ /nix/store/blb6ih6qrh58i9kkig3gjgkla4pddpzn-pass-env/bin/pass otp
Usage: pass otp [--clip,-c] pass-name

Can you reproduce that?

That wierdly works, but using the same in my hm config does not

nix-repl> :b legacyPackages.x86_64-linux.pass.withExtensions (p: [p.pass-otp])

This derivation produced the following outputs:
  out -> /nix/store/7id9vabqr7lhj99386fdwj8nrnpcyivq-pass-env
[1 built, 0.0 MiB DL]
$ /nix/store/7id9vabqr7lhj99386fdwj8nrnpcyivq-pass-env/bin/pass otp
Usage: pass otp [--clip,-c] pass-name

Maybe the problem is that hm install pass to /nix/store/q2hdfb8hzlcp0ssf62vsflv6xd5hbvp3-password-store-1.7.4/bin/pass so it install password-store not pass-env

Do you possibly have password-store twice?

Seems like password-store and pass-env both get installed even through I only set it up once:

❯ nix-store --query --requisites $(readlink -f /nix/var/nix/profiles/system) | grep pass
/nix/store/13gcvcbzm8j174arc9xq9myar0np2zay-unit-systemd-ask-password-plymouth.path
/nix/store/nrgacrm3m3bzbws7xf3qlzdakjx5606r-mkpasswd-5.5.23
/nix/store/1c8msfliy2i906y4nlrjbv5jv57p4bsg-privacy-pass-4.0.2
/nix/store/w9dnghpxdcb13n1w2sqzs73qdmsk3acn-python3.11-pypass-0.2.1
/nix/store/b0a0cswf1kvnq11f53hl2z0xks9lkps8-pass-secret-service-unstable-2022-07-18
/nix/store/7xci9lhi2cgnvrvcgl5wvzdqlj4zavyd-unmount-bindMount--persist-data-home-hugob-password-store-
/nix/store/vzkn853a619kfbj1zh0p2n4xp76xp7jl-bindMount--persist-data-home-hugob-password-store-
/nix/store/ffhskawgbfcv35dycf7ra0f3d7pzb432-bindMount--persist-data-home-hugob-password-store-.service
/nix/store/9rbmk9yknmbwmjdw2k78m8njlw6brn8f-password-store-1.7.4
/nix/store/2rsqxk4vbmd6vy6yr9iddjkbwlwf782l-password-store-1.7.4
/nix/store/aa4d3zrvj5fjv9ab80g9wh1w3l4zpmhj-python3.12-pykeepass-4.1.0.post1
/nix/store/dgh5dw6dbnp2hav61ycihv271gw5bhxk-pass-import-3.5
/nix/store/pv72hsi2vvq18crgxjkzssf9ql0yiw6p-pass-otp-1.2.0
/nix/store/yv50bdixqcb3kbk29b7ff037xjcv8f5w-pass-env
/nix/store/wlsxqj1k0xyjiagdl15zmdg4h6gpn90y-pass-env-fish-completions
/nix/store/wmmbz62471zsp36gp5pa72jjfd9431yg-mkpasswd-5.5.23-fish-completions
/nix/store/n4m9ad3dcm5xawwafzrnmf17wf8ra5y1-passff-1.20
/nix/store/ryh1lyxlmri244d5sayvmk13xbhqa6g4-pass-secret-service.service
/nix/store/zqxx5r7g678y6jjj3slbax6yfj6x1f3l-proton-pass-1.21.2
/nix/store/4117gysxbvyb2kr8c9lxlwsksnac6gv1-chpasswd.pam
/nix/store/cg0n43inzsfl1fsghdi747bpm3j25qzw-mkpasswd-5.5.23_fish-completions
/nix/store/ng6jqya5waqks8lldcm2hhgbpdi9kmaj-passwd.pam
/nix/store/v7ykw7ygd9bxycxdz6sflmw4psrf07sv-security-wrapper-passwd-x86_64-unknown-linux-musl
/nix/store/gkisakjkjr7a9b1mrwsvi5p8g9xnvkfz-unit-systemd-ask-password-plymouth.service

Never mind seems like i installed it via nix-env and never removed it :expressionless:
Still thanks for the help