This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / pass / flake-module.nix
2.5 kB 78 lines
1{ self, ... }: 2{ 3 perSystem = 4 { 5 pkgs, 6 system, 7 ... 8 }: 9 { 10 packages.pass = self.libWithPkgs.${system}.makeWrapper pkgs.passage { 11 runtimeInputs = [ 12 pkgs.age-plugin-se 13 pkgs.age-plugin-fido2-hmac 14 pkgs.age-plugin-yubikey 15 self.packages.${system}.pass-otp 16 ]; 17 wrapper = 18 { 19 exePath, 20 envString, 21 preHook, 22 ... 23 }: 24 '' 25 ${envString} 26 ${preHook} 27 28 # Check if bulk key file should be used for decryption 29 if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]]; then 30 if [[ ! -f "$PASS_BULK_KEY_FILE" ]] || [[ ! -s "$PASS_BULK_KEY_FILE" ]]; then 31 mkdir -p "$(dirname "$PASS_BULK_KEY_FILE")" 32 ${exePath} show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true 33 fi 34 fi 35 36 # Handle OTP commands by delegating to pass-otp 37 if [[ "''${1:-}" == "otp" ]]; then 38 shift 39 # Extract pass name and options 40 clip_arg="" 41 pass_name="" 42 for arg in "$@"; do 43 case "$arg" in 44 "--clip"|"-c") 45 clip_arg="--clip" 46 ;; 47 *) 48 pass_name="$arg" 49 ;; 50 esac 51 done 52 53 if [[ -z "$pass_name" ]]; then 54 echo "Usage: pass otp [--clip,-c] pass-name" 55 exit 1 56 fi 57 58 # Use bulk key for decryption if available 59 if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then 60 PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE" ${exePath} show "$pass_name" | pass-otp $clip_arg 61 else 62 ${exePath} show "$pass_name" | pass-otp $clip_arg 63 fi 64 # Handle show commands with bulk key optimization 65 elif [[ "''${1:-}" == "show" ]]; then 66 if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then 67 PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE" ${exePath} "$@" 68 else 69 ${exePath} "$@" 70 fi 71 else 72 # Pass all other commands directly to passage 73 ${exePath} "$@" 74 fi 75 ''; 76 }; 77 }; 78}