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