stockholm/krebs/5pkgs/simple/brain/default.nix

29 lines
711 B
Nix
Raw Normal View History

2024-06-25 09:30:34 +00:00
{ pkgs }:
2017-06-18 14:06:37 +00:00
2024-06-25 09:30:34 +00:00
let
pass = pkgs.pass.withExtensions (ext: [
ext.pass-otp
]);
in
pkgs.write "brain" {
"/bin/brain".link = pkgs.writeDash "brain" ''
2017-06-18 14:06:37 +00:00
PASSWORD_STORE_DIR=$HOME/brain \
2024-06-25 09:30:15 +00:00
exec ${pass}/bin/pass "$@"
2017-06-18 14:06:37 +00:00
'';
2024-06-25 09:30:34 +00:00
"/bin/brainmenu".link = pkgs.writeDash "brainmenu" ''
2017-06-18 14:06:37 +00:00
PASSWORD_STORE_DIR=$HOME/brain \
2024-06-25 09:30:15 +00:00
exec ${pass}/bin/passmenu "$@"
2017-06-18 14:06:37 +00:00
'';
2023-08-01 11:17:30 +00:00
"/share/bash-completion/completions/brain".link =
2024-06-25 09:30:34 +00:00
pkgs.runCommand "brain-completions" {
2023-08-01 11:17:30 +00:00
} /* sh */ ''
sed -r '
s/\<_pass?(_|\>)/_brain\1/g
s/\<__password_store/_brain/g
s/\<pass\>/brain/
s/\$HOME\/\.password-store/$HOME\/brain/
' < ${pass}/share/bash-completion/completions/pass > $out
'';
2017-06-18 14:06:37 +00:00
}