2DCSBI5WHA34B5NDE27MLEFQALF3O2MN4W75E5Y6EIVBY5C3JM6QC
MVNMJSMSZXOSFGJOGZGHXODI7XNFF6WA4V64CE6VRFUFBHC4UDZQC
WVAJNAJ4EVTTIREWQDTBMGASLMWJUVBHIM2MKKOFTFYVIIMR6CBAC
FOKLIP6Z2B4ZEB4G4U6QHPJXF6Y2RP2I625RHKGCDGYCMMNOAXMQC
WDP6T2ZX5WH6K4JAGAUTWAS6GIVG3NOXO4STOLY5RT7W7I67CIZAC
2MH4TU2HSSXKDWLUQXEBJER4F52ALDFAKVUVNT5O4XSFZHPYV53QC
O64A6IJJGMWJYUDR6VUFGYFPWWPN222BEMMLFCMLKDEFO5OVRE4QC
3RG3K64UNBVMFYBBHNYCI7Y6GI7NZAHCCT76GMBBGK7PO4744BLAC
3OAFCHK7EIRUD3ZLAGZ3MAXVYOGFAJVDOF63ZIGNU7I3RWIPMAOQC
5HLAP6OIMUSEZK2JBMEG7LUHNZZIBWPJBPZBB4S6FUBHD5L43VAQC
LTSFJDOV7PWQTVB44ZAPDHR6HUOAG4WZJQPP7TBCXRBS57EZ5T3AC
YETF5UHCE3GS27IXWNLS4I3PVVBCFYRJTLPUETD5WILFFBEPTPRAC
5HXGJ3EZ5G7GSZ6A2PBFOQBYXP7WYU4QOCKG2ND2TX47XADKURQQC
CDPM6DBHOVF7BELYPC27BZNFQ6DFENMCERT2PB45ED2H25GBK2LAC
2KXMUFYOTAZO5GFGRFG6GGFJ3BIFO42O7CXBQRP2XH5WWZUOT6UAC
U6GSJX5ZG4O7R3XO4CA7G62TTDE22HRZ2LL7EQKLQSYCHCAA3CQQC
PVZI36WHTCMRPPMQRHNXTP63OT557JZUJI5UAB3DN6FB3XZOALKAC
xdg.configFile.flake8.text = ''
# Generated by home-manager from nixpkgs.python in ~/dotfiles
# For a list of options see: https://flake8.pycqa.org/en/latest/manpage.html
xdg.configFile.flake8.text = ''
# Generated by home-manager from nixpkgs.python in ~/dotfiles
# For a list of options see: https://flake8.pycqa.org/en/latest/manpage.html
config.home.packages = with pkgs; [
bemenu
passhole
];
config.xdg.configFile."passhole.ini".text = utils.mkINI {
chris_shared = {
default = true;
database = "~/MEGAsync/keepass/chris_shared.kdbx";
cache = "~/.cache/keepass_chris_shared_cache";
cache-timeout = 2 * 60 * 60; # 2 hours
config = lib.mkIf cfg.enable {
home.packages =
[passhole]
++ (
if cfg.swayIntegration.enable
then [pkgs.bemenu]
else []
);
xdg.configFile."passhole.ini".text = utils.mkINI {
chris_shared = {
default = true;
database = "~/MEGAsync/keepass/chris_shared.kdbx";
cache = "~/.cache/keepass_chris_shared_cache";
cache-timeout = 2 * 60 * 60; # 2 hours
};
config.wayland.windowManager.sway.config.keybindings = with pkgs; let
bemenu_choose_passhole_entry = writeShellApplication {
name = "bemenu_choose_passhole_entry";
runtimeInputs = [bemenu coreutils passhole];
text = "echo force_get_password_via_zenity | ph grep -i . | bemenu --ignorecase --center --margin 10 --list 10";
};
wlrctl_type_passhole_field_value = writeShellApplication {
name = "wlrctl_type_passhole_field_value";
runtimeInputs = [bemenu_choose_passhole_entry wlrctl];
text = ''
wlrctl keyboard type "$(ph show --field "$2" "$1")"
'';
};
bemenu_choose_passhole_field = writeShellApplication {
name = "bemenu_choose_passhole_field";
runtimeInputs = [bemenu coreutils passhole gnused];
# ph show needs the color codes and stuff stripped from it's output
text = ''
ph show "$1" \
| sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' \
| cut -d : -f 1 \
| bemenu --ignorecase --center --margin 10 --list 10
'';
};
in {
# adds a bemenu fuzzy finder, the password choice is typed out
# via a virtual keyboard
"${swayPrefix}+p" = let
name = "wlrctl_type_passhole_password";
in "exec ${writeShellApplication {
inherit name;
runtimeInputs = [bemenu_choose_passhole_entry wlrctl_type_passhole_field_value];
text = ''wlrctl_type_passhole_field_value "$(bemenu_choose_passhole_entry)" password'';
}}/bin/${name}";
wayland.windowManager.sway.config.keybindings = with pkgs; let
bemenu_choose_passhole_entry = writeShellApplication {
name = "bemenu_choose_passhole_entry";
runtimeInputs = [bemenu coreutils passhole];
text = "echo force_get_password_via_zenity | ph grep -i . | bemenu --ignorecase --center --margin 10 --list 10";
};
wlrctl_type_passhole_field_value = writeShellApplication {
name = "wlrctl_type_passhole_field_value";
runtimeInputs = [bemenu_choose_passhole_entry wlrctl];
text = ''
wlrctl keyboard type "$(ph show --field "$2" "$1")"
'';
};
bemenu_choose_passhole_field = writeShellApplication {
name = "bemenu_choose_passhole_field";
runtimeInputs = [bemenu coreutils passhole gnused];
# ph show needs the color codes and stuff stripped from it's output
text = ''
ph show "$1" \
| sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' \
| cut -d : -f 1 \
| bemenu --ignorecase --center --margin 10 --list 10
'';
};
in
lib.mkIf cfg.swayIntegration.enable {
# adds a bemenu fuzzy finder, the password choice is typed out
# via a virtual keyboard
"${swayPrefix}+p" = let
name = "wlrctl_type_passhole_password";
in "exec ${writeShellApplication {
inherit name;
runtimeInputs = [bemenu_choose_passhole_entry wlrctl_type_passhole_field_value];
text = ''wlrctl_type_passhole_field_value "$(bemenu_choose_passhole_entry)" password'';
}}/bin/${name}";
"${swayPrefix}+Shift+p" = let
name = "wlrctl_type_passhole_password";
in "exec ${writeShellApplication {
inherit name;
runtimeInputs = [bemenu_choose_passhole_entry wlrctl_type_passhole_field_value];
text = ''wlrctl_type_passhole_field_value "$(bemenu_choose_passhole_entry)" username'';
}}/bin/${name}";
"${swayPrefix}+Shift+p" = let
name = "wlrctl_type_passhole_password";
in "exec ${writeShellApplication {
inherit name;
runtimeInputs = [bemenu_choose_passhole_entry wlrctl_type_passhole_field_value];
text = ''wlrctl_type_passhole_field_value "$(bemenu_choose_passhole_entry)" username'';
}}/bin/${name}";
"${swayPrefix}+Ctrl+p" = let
name = "wlrctl_type_passhole_arbitrary_field";
in "exec ${writeShellApplication {
inherit name;
runtimeInputs = [bemenu_choose_passhole_entry bemenu_choose_passhole_field wlrctl_type_passhole_field_value];
text = ''
ENTRY="$(bemenu_choose_passhole_entry)"
FIELD="$(bemenu_choose_passhole_field "$ENTRY")"
wlrctl_type_passhole_field_value "$ENTRY" "$FIELD"
'';
}}/bin/${name}";
"${swayPrefix}+Ctrl+p" = let
name = "wlrctl_type_passhole_arbitrary_field";
in "exec ${writeShellApplication {
inherit name;
runtimeInputs = [bemenu_choose_passhole_entry bemenu_choose_passhole_field wlrctl_type_passhole_field_value];
text = ''
ENTRY="$(bemenu_choose_passhole_entry)"
FIELD="$(bemenu_choose_passhole_field "$ENTRY")"
wlrctl_type_passhole_field_value "$ENTRY" "$FIELD"
'';
}}/bin/${name}";
};
passhole.enable = mkEnableOption "Passhole is a python cli for interacting with keepass databases. I have some utilities built up around it, but in a GUI environment, keepassxc is a better tool. But this is useful for non-gui environments.";
python.enable = mkEnableOption "Install a python interpreter with optional packages. Generally this is better off as a project level dependency, but it can be handy to have a python interpreter always at the ready. ipython package included by default.";
{...}: {
imports = [
./shell.nix
];
}