Compare commits

...

4 Commits

Author SHA1 Message Date
Zynh Ludwig 0350f74f7b rbw: rbw-fzf x port 2024-08-24 15:17:04 -07:00
Zynh Ludwig b6fca59334 rbw: rbw-fzf 2024-08-24 15:13:20 -07:00
Zynh Ludwig e0a6ce3b64 rbw: pineentry-tty 2024-08-24 15:13:13 -07:00
Zynh Ludwig 8848f7df18 rbw: module init 2024-08-24 14:01:19 -07:00
2 changed files with 43 additions and 0 deletions

42
home/modules/rbw.nix Normal file
View File

@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:
let
cfg = config.snowhawk.rbw;
rbw-fzf = pkgs.writeShellApplication {
name = "rbw-fzf";
runtimeInputs = with pkgs; [ rbw fzf perl findutils coreutils jq ];
text = /*bash*/ ''
rbw ls --fields name,user |
sort -bi |
perl -ple 's/^([^\t]*)\t([^\t]*)$/$1 ($2)/gm' |
fzf --tmux --no-sort --with-shell='bash -c' \
--preview="echo {} | perl -plE 's/^(.*) \((.*)?\)$/\"\$1\" \"\$2\"/' |
xargs rbw get --full --raw | \
jq --color-output 'if .data.password != \"\" then setpath([\"data\", \"password\"]; \"************\") else . end | del(.history) | del(.id) | walk(if type == \"object\" then map_values(. // empty) else . end)'" \
--preview-label="Vault Item" --preview-window=wrap |
perl -plE 's/^(.*) \((.*)?\)$/"$1" "$2"/' |
xargs -r rbw get |
xclip -sel copy
'';
};
inherit (lib) mkIf mkEnableOption;
in
{
options.snowhawk.rbw = {
enable = mkEnableOption "rbw home-manager module";
};
config = mkIf cfg.enable {
programs.rbw.enable = true;
home.packages =
with pkgs; [
rbw
pinentry-tty
rbw-fzf
];
};
}

View File

@ -19,6 +19,7 @@ in
projects.enable = true;
dunst.enable = true;
sops.enable = true;
rbw.enable = true;
defaultPrograms.enable = true;
playerctl.enable = true;
redshift.enable = true;