Rework pass

- Remove pw script
- Add otp extension
This commit is contained in:
Jakob Lechner 2024-08-14 18:54:33 +02:00
parent 7f02d2b668
commit 368f648adc

View file

@ -1,35 +1,18 @@
{ nixosConfig, pkgs, ... }:
{ nixosConfig, lib, config, pkgs, ... }:
let
pw = pkgs.writeScriptBin "pw" ''
p="$(${pkgs.pass}/bin/pass show "$1")"
copy_line() {
echo -n "$p" \
| ${pkgs.gnused}/bin/sed -n "$1"p \
| ${pkgs.wl-clipboard}/bin/wl-copy \
--paste-once \
--foreground \
--trim-newline \
--type text/plain
}
echo "username"
copy_line 2
echo "password"
copy_line 1
'';
in
{
home.packages = [
pw
] ++
(
if nixosConfig.jalr.gui.enable
then with pkgs; [
qtpass
pass-wayland
]
else [ ]
);
programs.password-store = {
enable = true;
package =
if nixosConfig.jalr.gui.enable
then pkgs.pass-wayland.withExtensions (exts: [ exts.pass-otp ])
else pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
};
home.packages = lib.optionals nixosConfig.jalr.gui.enable [
pkgs.qtpass
];
xdg.dataFile.password-store = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.password-store";
target = "password-store";
};
}