diff --git a/home-manager/roles/default.nix b/home-manager/roles/default.nix index 0b9f49f5..68e8cab9 100644 --- a/home-manager/roles/default.nix +++ b/home-manager/roles/default.nix @@ -63,7 +63,7 @@ ''; }; password-store = { - package = pkgs.pass-wayland.withExtensions (exts: [exts.pass-update pkgs.pass-clip exts.pass-otp]); + package = pkgs.pass-wayland.withExtensions (exts: [exts.pass-update exts.pass-otp]); enable = true; settings.PASSWORD_STORE_DIR = "${config.home.homeDirectory}/git/password-store"; }; diff --git a/home-manager/roles/hotkeys.nix b/home-manager/roles/hotkeys.nix index 62ca62e2..a5e6da54 100644 --- a/home-manager/roles/hotkeys.nix +++ b/home-manager/roles/hotkeys.nix @@ -21,6 +21,12 @@ in [ Edit = "codium ~/git/promotion"; }; } + { + Passmenu = { + Password = "pass-fzf"; + OTP = "pass-fzf otp"; + }; + } { Power = { Shutdown = "systemctl poweroff"; @@ -88,7 +94,6 @@ in [ VoxMachina = "mpv https://www.youtube.com/playlist?list=PL1tiwbzkOjQz7D0l_eLJGAISVtcL7oRu_"; }; } - {Passmenu = "pass clip -f";} {"Select Mode" = "select-mode";} { Communication = [ diff --git a/overlays/pass-clip/default.nix b/overlays/pass-clip/default.nix deleted file mode 100644 index 1818e920..00000000 --- a/overlays/pass-clip/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -self: super: { - pass-clip = - self.callPackage - ({ - stdenv, - fetchFromGitHub, - pass-wayland, - }: - stdenv.mkDerivation rec { - name = "${pname}-${version}"; - pname = "pass-clip"; - version = "0.3"; - src = fetchFromGitHub { - owner = "ibizaman"; - repo = "pass-clip"; - rev = "v${version}"; - sha256 = "0myyyw0azci95jp8lwh6bm7xi171fv9vg8j6lzf9m9n7282cmy33"; - }; - dontBuild = true; - installPhase = "PREFIX=$out make install"; - propagatedBuildInputs = [pass-wayland]; - }) - {}; -} diff --git a/overlays/pass-fzf.sh b/overlays/pass-fzf.sh new file mode 100644 index 00000000..d2735d1a --- /dev/null +++ b/overlays/pass-fzf.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +## Adapted from https://gist.github.com/heywoodlh/4c1e27f477a896bc3b0f6d55e2748d26 + +## Assumes that the user is using otp plugin +## Install fzf and make sure pass is configured beforehand + +## If you want to grab the otp code, use like so: `pass-fzf.sh otp`, otherwise script will assume you want password + +cd ~/.password-store || exit + +if [[ $1 == 'otp' ]] +then + type="otp" +else + type="password" +fi + +selection="$(find -L . -name '*.gpg' | sed -e 's/.\///' -e 's/.gpg//' | fzf)" + +if [ ${type} == "otp" ] +then + pass otp "${selection}" -c + +else + pass "${selection}" -c +fi + diff --git a/overlays/pkgSets.nix b/overlays/pkgSets.nix index 0269b93c..70a17db9 100644 --- a/overlays/pkgSets.nix +++ b/overlays/pkgSets.nix @@ -158,6 +158,7 @@ self: super: { gh ; obelisk = (import self.sources.obelisk {}).command; + pass-fzf = self.writeShellScriptBin "pass-fzf" (builtins.readFile ./pass-fzf.sh); }; accounting-pkgs = { inherit (self.haskellPackages) hledger hledger-ui hledger-web;