Pass changes
This commit is contained in:
parent
0c26b0e6fa
commit
dfcd258971
6 changed files with 46 additions and 10 deletions
7
programs/firefox/default.nix
Normal file
7
programs/firefox/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ pkgs }:
|
||||
|
||||
(pkgs.firefox.override {
|
||||
extraNativeMessagingHosts = [
|
||||
(pkgs.passff-host.override { pass = (import ../pass/default.nix { inherit pkgs; }); })
|
||||
];
|
||||
})
|
3
programs/pass/default.nix
Normal file
3
programs/pass/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{ pkgs }:
|
||||
|
||||
(pkgs.pass-wayland.override { pass = pkgs.pass-wayland; }).withExtensions (ext: [ ext.pass-otp ext.pass-genphrase ])
|
|
@ -1,6 +1,7 @@
|
|||
with import <nixpkgs> { };
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
firefox = import ../firefox/default.nix { inherit pkgs; };
|
||||
launcher = import ./launcher.nix { inherit pkgs stdenv; };
|
||||
color-picker = import ./color-picker.nix { inherit pkgs; };
|
||||
screenshot = import ./screenshot.nix { inherit pkgs; };
|
||||
|
@ -97,7 +98,7 @@ in
|
|||
|
||||
### Startup programs
|
||||
#
|
||||
exec ${pkgs.firefox}/bin/firefox
|
||||
exec ${firefox}/bin/firefox
|
||||
exec ${pkgs.thunderbird}/bin/thunderbird
|
||||
exec ${pkgs.joplin-desktop}/bin/joplin-desktop
|
||||
exec ${pkgs.teams}/bin/teams
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ pkgs, stdenv }:
|
||||
let
|
||||
pass = import ../pass/default.nix { inherit pkgs; };
|
||||
gemoji = pkgs.buildRubyGem {
|
||||
pname = "gemoji";
|
||||
gemName = "gemoji";
|
||||
|
@ -57,6 +58,36 @@ pkgs.writeScriptBin "launcher" ''
|
|||
${pkgs.sway}/bin/swaymsg exec -- "echo -n $char | ${pkgs.wl-clipboard}/bin/wl-copy --foreground"
|
||||
}
|
||||
|
||||
pass_options(){
|
||||
prefix=''${PASSWORD_STORE_DIR-~/.password-store}
|
||||
password_files=( "$prefix"/**/*.gpg )
|
||||
printf 'pass password %s\n' ''${''${password_files%.gpg}#$prefix/}
|
||||
printf 'pass username %s\n' ''${''${password_files%.gpg}#$prefix/}
|
||||
printf 'pass otp %s\n' ''${''${password_files%.gpg}#$prefix/}
|
||||
printf 'pass edit %s\n' ''${''${password_files%.gpg}#$prefix/}
|
||||
}
|
||||
|
||||
pass() {
|
||||
option=$(echo $1 | sed "s/^\([^ ]*\) .*$/\1/")
|
||||
passfile=$(echo $1 | sed "s/^[^ ]* \(.*$\)/\1/")
|
||||
echo $option
|
||||
echo $passfile
|
||||
case $option in
|
||||
username)
|
||||
swaymsg exec -- "${pass}/bin/pass show '$passfile' | sed -n 's/^Username: *//p' | tr -d '\n' | ${pkgs.wl-clipboard}/bin/wl-copy --foreground"
|
||||
;;
|
||||
password)
|
||||
swaymsg exec -- "${pass}/bin/pass show -c0 '$passfile'"
|
||||
;;
|
||||
otp)
|
||||
swaymsg exec -- "${pass}/bin/pass otp -c '$passfile'"
|
||||
;;
|
||||
edit)
|
||||
${pass}/bin/pass edit "$passfile"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
record_options() {
|
||||
${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[]["name"]' | sed "s/^/record /"
|
||||
echo record select
|
||||
|
@ -125,7 +156,7 @@ pkgs.writeScriptBin "launcher" ''
|
|||
${pkgs.sway}/bin/swaymsg \[con_id="$window"\] focus
|
||||
}
|
||||
|
||||
CHOSEN=$(cat <(windows_options) <(tmuxinator_options) <(ssh_options) <(systemctl_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | ${pkgs.fzy}/bin/fzy --lines 36 | tail -n1)
|
||||
CHOSEN=$(cat <(windows_options) <(tmuxinator_options) <(ssh_options) <(systemctl_options) <(pass_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | ${pkgs.fzy}/bin/fzy --lines 36 | tail -n1)
|
||||
|
||||
if [ -n "$CHOSEN" ]
|
||||
then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue