summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/brain/default.nix
blob: bf52da75f4bc156a54616ee50ae76f2803da2a6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ pass, runCommand, write, writeDash, ... }:

write "brain" {
  "/bin/brain".link = writeDash "brain" ''
    PASSWORD_STORE_DIR=$HOME/brain \
    exec ${pass}/bin/pass $@
  '';
  "/bin/brainmenu".link = writeDash "brainmenu" ''
    PASSWORD_STORE_DIR=$HOME/brain \
    exec ${pass}/bin/passmenu $@
  '';
  "/share/bash-completion/completions/brain".link =
    runCommand "brain-completions" {
    } /* 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
    '';
}