alpha
Login
or
Join now
hermes.pds.lassul.us
/
superconfig
forked from
lass.pds.lassul.us/superconfig
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
tools.pass: fix on darwin
author
lassulus
date
8 months ago
(Feb 15, 2026, 8:29 PM CET)
commit
22127e4f
22127e4fb30ced2bbc7568019d5fd061a813f5aa
parent
5da6db46
5da6db46e953dd989528cc5e94453f29dd78fbee
+85
-73
1 changed file
Expand all
Collapse all
Unified
Split
tools
pass
flake-module.nix
+85
-73
tools/pass/flake-module.nix
View file
Reviewed
···
16
16
pkgs.age-plugin-tpm
17
17
self.packages.${system}.pass-otp
18
18
self.packages.${system}.age-detect
19
19
-
self.packages.${system}.pinentry-rofi-age
20
19
]
20
20
+
++ (pkgs.lib.optionals pkgs.stdenv.isLinux [
21
21
+
self.packages.${system}.pinentry-rofi-age
22
22
+
])
21
23
++ (pkgs.lib.optionals pkgs.stdenv.isDarwin [
22
24
pkgs.age-plugin-se
23
25
])
···
38
40
...
39
41
}:
40
42
''
41
41
-
set -x
42
42
-
${envString}
43
43
-
${preHook}
43
43
+
set -x
44
44
+
${envString}
45
45
+
${preHook}
44
46
45
45
-
# Check if bulk key file should be used for decryption
46
46
-
if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]]; then
47
47
-
if [[ ! -f "$PASS_BULK_KEY_FILE" ]] || [[ ! -s "$PASS_BULK_KEY_FILE" ]]; then
48
48
-
mkdir -p "$(dirname "$PASS_BULK_KEY_FILE")"
49
49
-
${exePath} show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true
50
50
-
fi
51
51
-
fi
47
47
+
# Check if bulk key file should be used for decryption
48
48
+
if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]]; then
49
49
+
if [[ ! -f "$PASS_BULK_KEY_FILE" ]] || [[ ! -s "$PASS_BULK_KEY_FILE" ]]; then
50
50
+
mkdir -p "$(dirname "$PASS_BULK_KEY_FILE")"
51
51
+
${exePath} show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true
52
52
+
fi
53
53
+
fi
52
54
53
53
-
# Set up identities for age decryption
54
54
-
if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then
55
55
-
# Use bulk key if available
56
56
-
export PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE"
57
57
-
else
58
58
-
# Detect available age keys
59
59
-
export AGE_DETECT_KEYS_DIR="${self}/keys"
60
60
-
eval "$(age-detect)"
55
55
+
# Set up identities for age decryption
56
56
+
if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then
57
57
+
# Use bulk key if available
58
58
+
export PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE"
59
59
+
else
60
60
+
# Detect available age keys
61
61
+
export AGE_DETECT_KEYS_DIR="${self}/keys"
62
62
+
eval "$(age-detect)"
61
63
62
62
-
# Set up identity file if detected
63
63
-
if [[ -n "''${IDENTITY_FILE:-}" ]]; then
64
64
-
export PASSAGE_IDENTITIES_FILE="$IDENTITY_FILE"
65
65
-
trap 'rm -f "$IDENTITY_FILE"' EXIT
66
66
-
fi
67
67
-
fi
64
64
+
# Set up identity file if detected
65
65
+
if [[ -n "''${IDENTITY_FILE:-}" ]]; then
66
66
+
export PASSAGE_IDENTITIES_FILE="$IDENTITY_FILE"
67
67
+
trap 'rm -f "$IDENTITY_FILE"' EXIT
68
68
+
fi
69
69
+
fi
68
70
69
69
-
maybe_set_tpm_pin() {
70
70
-
local target="''${1:-<stdin>}"
71
71
-
if [[ "''${KEY_TYPE:-}" != "tpm" ]]; then
72
72
-
return 0
73
73
-
fi
74
74
-
if [[ -n "''${AGE_TPM_PIN:-}" ]]; then
75
75
-
return 0
76
76
-
fi
77
77
-
AGE_TPM_PIN="$(${self.packages.${system}.pinentry-rofi-age}/bin/pinentry-rofi-age "$target")"
78
78
-
export AGE_TPM_PIN
71
71
+
${
72
72
+
if pkgs.stdenv.isLinux then
73
73
+
''
74
74
+
maybe_set_tpm_pin() {
75
75
+
local target="''${1:-<stdin>}"
76
76
+
if [[ "''${KEY_TYPE:-}" != "tpm" ]]; then
77
77
+
return 0
78
78
+
fi
79
79
+
if [[ -n "''${AGE_TPM_PIN:-}" ]]; then
80
80
+
return 0
81
81
+
fi
82
82
+
AGE_TPM_PIN="$(${self.packages.${system}.pinentry-rofi-age}/bin/pinentry-rofi-age "$target")"
83
83
+
export AGE_TPM_PIN
84
84
+
}
85
85
+
86
86
+
decrypt_target=""
87
87
+
if [[ "''${1:-}" == "show" ]]; then
88
88
+
decrypt_target="''${2:-}"
89
89
+
elif [[ -n "''${1:-}" ]] && [[ "''${1:-}" != -* ]] && [[ "''${1:-}" != "otp" ]]; then
90
90
+
decrypt_target="''${1:-}"
91
91
+
fi
92
92
+
93
93
+
if [[ -n "$decrypt_target" ]]; then
94
94
+
maybe_set_tpm_pin "$decrypt_target"
95
95
+
fi
96
96
+
''
97
97
+
else
98
98
+
''
99
99
+
# No TPM on Darwin, define no-op
100
100
+
maybe_set_tpm_pin() { :; }
101
101
+
''
79
102
}
80
103
81
81
-
decrypt_target=""
82
82
-
if [[ "''${1:-}" == "show" ]]; then
83
83
-
decrypt_target="''${2:-}"
84
84
-
elif [[ -n "''${1:-}" ]] && [[ "''${1:-}" != -* ]] && [[ "''${1:-}" != "otp" ]]; then
85
85
-
decrypt_target="''${1:-}"
86
86
-
fi
104
104
+
# Handle OTP commands by delegating to pass-otp
105
105
+
if [[ "''${1:-}" == "otp" ]]; then
106
106
+
shift
107
107
+
# Extract pass name and options
108
108
+
clip_arg=""
109
109
+
pass_name=""
110
110
+
for arg in "$@"; do
111
111
+
case "$arg" in
112
112
+
"--clip"|"-c")
113
113
+
clip_arg="--clip"
114
114
+
;;
115
115
+
*)
116
116
+
pass_name="$arg"
117
117
+
;;
118
118
+
esac
119
119
+
done
87
120
88
88
-
if [[ -n "$decrypt_target" ]]; then
89
89
-
maybe_set_tpm_pin "$decrypt_target"
90
90
-
fi
121
121
+
if [[ -z "$pass_name" ]]; then
122
122
+
echo "Usage: pass otp [--clip,-c] pass-name"
123
123
+
exit 1
124
124
+
fi
91
125
92
92
-
# Handle OTP commands by delegating to pass-otp
93
93
-
if [[ "''${1:-}" == "otp" ]]; then
94
94
-
shift
95
95
-
# Extract pass name and options
96
96
-
clip_arg=""
97
97
-
pass_name=""
98
98
-
for arg in "$@"; do
99
99
-
case "$arg" in
100
100
-
"--clip"|"-c")
101
101
-
clip_arg="--clip"
102
102
-
;;
103
103
-
*)
104
104
-
pass_name="$arg"
105
105
-
;;
106
106
-
esac
107
107
-
done
108
108
-
109
109
-
if [[ -z "$pass_name" ]]; then
110
110
-
echo "Usage: pass otp [--clip,-c] pass-name"
111
111
-
exit 1
112
112
-
fi
113
113
-
114
114
-
# Show pass and pipe to OTP (identities already set up by age-detect)
115
115
-
maybe_set_tpm_pin "$pass_name"
116
116
-
${exePath} show "$pass_name" | pass-otp $clip_arg
117
117
-
else
118
118
-
# Pass all other commands directly to passage (identities already set up)
119
119
-
${exePath} "$@"
120
120
-
fi
126
126
+
# Show pass and pipe to OTP (identities already set up by age-detect)
127
127
+
maybe_set_tpm_pin "$pass_name"
128
128
+
${exePath} show "$pass_name" | pass-otp $clip_arg
129
129
+
else
130
130
+
# Pass all other commands directly to passage (identities already set up)
131
131
+
${exePath} "$@"
132
132
+
fi
121
133
'';
122
134
};
123
135
};