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.6 kB 85 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 self.packages.${system}.age-detect 17 ]; 18 aliases = [ "pass" ]; 19 wrapper = 20 { 21 exePath, 22 envString, 23 preHook, 24 ... 25 }: 26 '' 27 set -x 28 ${envString} 29 ${preHook} 30 31 # Check if bulk key file should be used for decryption 32 if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]]; then 33 if [[ ! -f "$PASS_BULK_KEY_FILE" ]] || [[ ! -s "$PASS_BULK_KEY_FILE" ]]; then 34 mkdir -p "$(dirname "$PASS_BULK_KEY_FILE")" 35 ${exePath} show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true 36 fi 37 fi 38 39 # Set up identities for age decryption 40 if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then 41 # Use bulk key if available 42 export PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE" 43 else 44 # Detect available age keys 45 eval "$(age-detect)" 46 47 # Set up identity file if detected 48 if [[ -n "''${IDENTITY_FILE:-}" ]]; then 49 export PASSAGE_IDENTITIES_FILE="$IDENTITY_FILE" 50 trap 'rm -f "$IDENTITY_FILE"' EXIT 51 fi 52 fi 53 54 # Handle OTP commands by delegating to pass-otp 55 if [[ "''${1:-}" == "otp" ]]; then 56 shift 57 # Extract pass name and options 58 clip_arg="" 59 pass_name="" 60 for arg in "$@"; do 61 case "$arg" in 62 "--clip"|"-c") 63 clip_arg="--clip" 64 ;; 65 *) 66 pass_name="$arg" 67 ;; 68 esac 69 done 70 71 if [[ -z "$pass_name" ]]; then 72 echo "Usage: pass otp [--clip,-c] pass-name" 73 exit 1 74 fi 75 76 # Show pass and pipe to OTP (identities already set up by age-detect) 77 ${exePath} show "$pass_name" | pass-otp $clip_arg 78 else 79 # Pass all other commands directly to passage (identities already set up) 80 ${exePath} "$@" 81 fi 82 ''; 83 }; 84 }; 85}