Add octofriend configuration to flake

- Embed octofriend.json5 config directly in flake.nix postInstall
- Set OCTOFRIEND_CONFIG_DIR to point to included config
- Add comprehensive README with setup and configuration instructions
- Keep API keys out of repo for security (users must add keys.json5 locally)
This commit is contained in:
Julian Sutter 2025-12-18 21:12:48 -08:00
parent 1c35f03eae
commit 00eb03dcd2
2 changed files with 98 additions and 3 deletions

View file

@ -37,12 +37,43 @@
postInstall = ''
if [ -x "$out/bin/octofriend" ]; then
wrapProgram "$out/bin/octofriend" \
--prefix PATH : ${lib.makeBinPath [ pkgs.git pkgs.openssh ]}
--prefix PATH : ${lib.makeBinPath [ pkgs.git pkgs.openssh ]} \
--set OCTOFRIEND_CONFIG_DIR "$out/share/octofriend/config"
fi
# Provide the short alias if upstream didnt already.
# Provide the short alias if upstream didn't already.
if [ -x "$out/bin/octofriend" ] && [ ! -e "$out/bin/octo" ]; then
ln -s "$out/bin/octofriend" "$out/bin/octo"
fi
# Install the config file
mkdir -p "$out/share/octofriend/config"
cat << 'EOF' > "$out/share/octofriend/config/octofriend.json5"
{
yourName: 'Jules',
models: [
{
model: 'hf:zai-org/GLM-4.6',
nickname: 'GLM-4.6 (Synthetic)',
context: 131072,
baseUrl: 'https://api.synthetic.new/v1',
},
{
model: 'hf:MiniMaxAI/MiniMax-M2',
nickname: 'MiniMax M2 (Synthetic)',
context: 98304,
baseUrl: 'https://api.synthetic.new/v1',
},
],
defaultApiKeyOverrides: {},
diffApply: {
baseUrl: 'https://api.synthetic.new/v1',
model: 'hf:syntheticlab/diff-apply',
},
fixJson: {
baseUrl: 'https://api.synthetic.new/v1',
model: 'hf:syntheticlab/fix-json',
},
}
EOF
'';
meta = with lib; {
@ -58,4 +89,4 @@
exePath = "/bin/octofriend";
};
});
}
}