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:
parent
1c35f03eae
commit
00eb03dcd2
2 changed files with 98 additions and 3 deletions
64
appflakes/octofriend/README.md
Normal file
64
appflakes/octofriend/README.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# Octofriend flake for Nix/NixOS
|
||||
|
||||
This flake packages [octofriend](https://github.com/synthetic-lab/octofriend), a CLI coding assistant.
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
nix build .
|
||||
```
|
||||
|
||||
## Running
|
||||
|
||||
```bash
|
||||
nix run .
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Add to your NixOS configuration:
|
||||
```nix
|
||||
inputs.octofriend.url = "path:/home/jsutter/src/nixos/appflakes/octofriend";
|
||||
|
||||
# Then in your environment.systemPackages or home.packages:
|
||||
self.inputs.octofriend.packages.${system}.default
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The octofriend flake includes default configuration files at `/share/octofriend/config/octofriend.json5`. However, API keys should not be stored in the repository for security reasons.
|
||||
|
||||
### Default Configuration
|
||||
|
||||
The included configuration provides:
|
||||
- Your name as 'Jules'
|
||||
- Two model configurations (GLM-4.6 and MiniMax M2) pointing to https://api.synthetic.new
|
||||
- Specialized models for diff-apply and fix-json operations
|
||||
|
||||
### API Keys
|
||||
|
||||
To configure API keys, create a `keys.json5` file in your configuration directory:
|
||||
```json5
|
||||
{
|
||||
'https://api.synthetic.new/v1': 'your-api-key-here'
|
||||
}
|
||||
```
|
||||
|
||||
When using octofriend, you can either:
|
||||
1. Place your keys in `~/.config/octofriend/keys.json5` (default location)
|
||||
2. Set the `OCTOFRIEND_CONFIG_DIR` environment variable to a custom directory containing your files
|
||||
|
||||
This ensures sensitive API keys are not committed to the repository while still providing functional default configuration.
|
||||
|
||||
### Custom Configuration
|
||||
|
||||
If you want to override the default configuration, you can create your own `octofriend.json5` file in your config directory. The wrapper script will check for configuration files in the following order:
|
||||
1. `$OCTOFRIEND_CONFIG_DIR/octofriend.json5` (if OCTOFRIEND_CONFIG_DIR is set)
|
||||
2. `~/.config/octofriend/octofriend.json5`
|
||||
3. Fall back to the included default at `$OCTOFRIEND_PACKAGE_DIR/share/octofriend/config/octofriend.json5`
|
||||
|
||||
## Security Note
|
||||
|
||||
- The `keys.json5` file containing API keys is intentionally NOT included in this flake
|
||||
- Never commit API keys to any repository
|
||||
- The included configuration uses placeholder settings and should be customized with your actual model preferences and endpoints
|
||||
|
|
@ -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 didn’t 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; {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue