Skip to content

Commit a7678e2

Browse files
committed
fix(darwin): preserve OrbStack SSH config across nixswitch activations
The activation script that manages ~/.ssh/config was overwriting OrbStack's Include directive, breaking both OrbStack and 1Password SSH agent connectivity for git commit signing.
1 parent cf431e5 commit a7678e2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

systems/aarch64-darwin/default.nix

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,26 @@ in {
122122

123123
userSshConfig.text = ''
124124
mkdir -p /Users/${username}/.ssh
125+
SSH_CONFIG="/Users/${username}/.ssh/config"
126+
127+
# Preserve OrbStack include if present
128+
ORBSTACK_BLOCK=""
129+
if [ -f "$SSH_CONFIG" ] && grep -q 'orbstack' "$SSH_CONFIG"; then
130+
ORBSTACK_BLOCK=$(grep -A1 'Include.*orbstack' "$SSH_CONFIG" | head -2)
131+
fi
132+
133+
# Write managed config
125134
cp ${
126135
config.environment.etc."user-ssh-config".source
127-
} /Users/${username}/.ssh/config
128-
chown ${username}:staff /Users/${username}/.ssh/config
129-
chmod 600 /Users/${username}/.ssh/config
136+
} "$SSH_CONFIG"
137+
138+
# Re-append OrbStack include
139+
if [ -n "$ORBSTACK_BLOCK" ]; then
140+
printf '\n%s\n' "$ORBSTACK_BLOCK" >> "$SSH_CONFIG"
141+
fi
142+
143+
chown ${username}:staff "$SSH_CONFIG"
144+
chmod 600 "$SSH_CONFIG"
130145
'';
131146
};
132147
};

0 commit comments

Comments
 (0)