fix: Bundle fonts and patch Comfyroll for NixOS compatibility#18
fix: Bundle fonts and patch Comfyroll for NixOS compatibility#18jamesbrink merged 1 commit intomainfrom
Conversation
- Add bundled fonts (DejaVu, Liberation, Noto, Roboto) from nixpkgs - Create fonts directory in data dir with symlinked TTF files - Auto-patch ComfyUI_Comfyroll_CustomNodes to use bundled fonts instead of hardcoded /usr/share/fonts/truetype path - Fix ComfyUI-Manager config path (moved to user/__manager/) - Add Known Issues section to README documenting the restart requirement Fixes #17 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewThanks for tackling this NixOS font compatibility issue! Overall this is a solid solution that provides a pragmatic workaround for hardcoded paths in third-party custom nodes. Here's my detailed feedback: ✅ Strengths
🔍 Issues & Suggestions1. Race Condition in Font Symlinking (Minor)Location: The glob pattern expansion might fail if no TTF files exist: for font_file in "${bundledFonts}"/ttf/*.ttf "${bundledFonts}"/ttf/*.TTF; doIssue: If no files match, the loop will iterate over the literal string Suggested Fix: shopt -s nullglob # At the top of the script
# ... or use find instead:
find "${bundledFonts}/ttf" -name "*.ttf" -o -name "*.TTF" 2>/dev/null | while read -r font_file; do
filename=$(basename "\")
target="\/\"
if [[ \! -e "\" ]]; then
ln -sf "\" "\"
fi
done2. Brittle String Patching (Moderate)Location: sed -i "s|\"/usr/share/fonts/truetype\"|\"\\"|g" "\"Issues:
Suggested Improvements: # More flexible pattern matching (handles both quote styles)
if sed -i "s|[\"\']/usr/share/fonts/truetype[\"\']|\"\\"|g" "\"; then
echo "Patched ComfyUI_Comfyroll_CustomNodes for NixOS font compatibility"
else
echo "Warning: Failed to patch ComfyUI_Comfyroll_CustomNodes" >&2
fiAlternatively, consider a Python-based patch that modifies the AST for more robustness. 3. Missing Font Validation (Minor)Location: The Suggested Improvement: postBuild = ''
mkdir -p \/ttf
# Only symlink .ttf files, log any issues
find \/share/fonts -type f \( -name "*.ttf" -o -name "*.TTF" \) -exec ln -sf {} \/ttf/ \;
# Validate we actually got some fonts
if [ -z "$(ls -A \/ttf)" ]; then
echo "Warning: No TTF fonts found in bundled fonts" >&2
exit 1
fi
'';4. Potential Case-Sensitivity Issues (Minor)The code handles both 5. Documentation: Suggest Preventive Approach (Enhancement)Location: Consider adding a note about the root cause and suggesting users file upstream issues: **Why this happens**: These nodes use hardcoded paths that assume traditional Linux filesystem layouts. We're working with upstream maintainers to make paths configurable.
**Help improve this**: If you encounter other custom nodes with hardcoded paths, please report them in our issue tracker.🔒 Security Considerations✅ No security issues identified. The approach is safe because:
🎯 Performance Considerations✅ Minimal performance impact:
🧪 Test Coverage SuggestionsConsider adding integration tests:
📋 Nit: Code Style
✅ SummaryThis is a pragmatic solution to a real NixOS compatibility issue. The implementation is mostly solid with good documentation. The main improvements would be:
Recommendation: ✅ Approve with minor suggestions. The current implementation works and solves the immediate problem. The suggested improvements are optimizations that can be addressed in follow-up PRs if needed. Great work on documenting the Known Issues section - this will save users a lot of troubleshooting time! |
Summary
ComfyUI_Comfyroll_CustomNodesat startup to use bundled fonts instead of hardcoded/usr/share/fonts/truetypeuser/default/ComfyUI-Managertouser/__manager/)Test plan
nix run)CR Select Fontnode loads without/usr/share/fonts/truetypeerrorFixes #17
🤖 Generated with Claude Code