diff options
| author | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-07-25 13:40:27 -0400 |
|---|---|---|
| committer | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-07-25 13:40:27 -0400 |
| commit | f2fb01a55b54dae9a5c26c7e1bae3d17c18de73e (patch) | |
| tree | c861617d8ff6f5fdf188b1f7dd5774c1d17a3cd5 /modules/pass/default.nix | |
| parent | 8a0457f14d000b4aae8bbd4e950654802f01c584 (diff) | |
| download | home-f2fb01a55b54dae9a5c26c7e1bae3d17c18de73e.tar.gz | |
repo: format tree
Diffstat (limited to 'modules/pass/default.nix')
| -rw-r--r-- | modules/pass/default.nix | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/modules/pass/default.nix b/modules/pass/default.nix index a92c331..2e9ab15 100644 --- a/modules/pass/default.nix +++ b/modules/pass/default.nix @@ -1,8 +1,18 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.modules.pass; - inherit (lib) mkEnableOption mkOption mkIf types; + inherit (lib) + mkEnableOption + mkOption + mkIf + types + ; in { options.modules.pass = { @@ -26,29 +36,31 @@ in }; config = mkIf cfg.enable { - home.packages = with pkgs; [(writeShellScriptBin "passmenu" '' - shopt -s nullglob globstar + home.packages = with pkgs; [ + (writeShellScriptBin "passmenu" '' + shopt -s nullglob globstar - if [[ -n $WAYLAND_DISPLAY ]]; then - menu="${cfg.wmenu}" - elif [[ -n $DISPLAY ]]; then - menu="${cfg.xmenu}" # fallback to dmenu if running under x11 - else - echo "Error: No Wayland or X11 display detected" >&2 - exit 1 - fi + if [[ -n $WAYLAND_DISPLAY ]]; then + menu="${cfg.wmenu}" + elif [[ -n $DISPLAY ]]; then + menu="${cfg.xmenu}" # fallback to dmenu if running under x11 + else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 + fi - prefix=''${PASSWORD_STORE_DIR-~/.password-store} - password_files=( "$prefix"/**/*.gpg ) - password_files=( "''${password_files[@]#"$prefix"/}" ) - password_files=( "''${password_files[@]%.gpg}" ) + prefix=''${PASSWORD_STORE_DIR-~/.password-store} + password_files=( "$prefix"/**/*.gpg ) + password_files=( "''${password_files[@]#"$prefix"/}" ) + password_files=( "''${password_files[@]%.gpg}" ) - password=$(printf '%s\n' "''${password_files[@]}" | $menu "$@") + password=$(printf '%s\n' "''${password_files[@]}" | $menu "$@") - [[ -n $password ]] || exit + [[ -n $password ]] || exit - pass show -c "$password" 2>/dev/null - '')]; + pass show -c "$password" 2>/dev/null + '') + ]; programs.password-store = { package = pkgs.pass.override { dmenuSupport = false; @@ -56,9 +68,9 @@ in enable = true; settings = { PASSWORD_STORE_DIR = "${config.home.homeDirectory}/.password-store"; - PASSWORD_STORE_CHARACTER_SET=''[:alnum:]*!@^&_\-=[]|;~,./?''; - PASSWORD_STORE_CLIP_TIME="25"; - PASSWORD_STORE_KEY=cfg.key; + PASSWORD_STORE_CHARACTER_SET = ''[:alnum:]*!@^&_\-=[]|;~,./?''; + PASSWORD_STORE_CLIP_TIME = "25"; + PASSWORD_STORE_KEY = cfg.key; PASSWORD_STORE_ENABLE_EXTENSIONS = if cfg.enableExtensions then "1" else "0"; }; }; |