Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ Runtime packages (mutable): <data-directory>/.pip-packages/

A default manager config is created on first run with sensible defaults for personal use (`security_level=normal`, `network_mode=personal_cloud`).

## Known Issues

### Custom Nodes Requiring Patching

Some custom nodes have hardcoded paths that don't exist on NixOS. We automatically patch these at startup, but **a full service restart is required after installing them via Manager**.

| Node Pack | Issue | Fix |
|-----------|-------|-----|
| Comfyroll Studio (`ComfyUI_Comfyroll_CustomNodes`) | Hardcoded `/usr/share/fonts/truetype` | Patched to use bundled fonts |

**After installing these nodes:** Stop ComfyUI completely (Ctrl+C) and restart with `nix run` or `systemctl restart comfyui`. Manager's internal restart does not trigger the patching.

## Bundled Custom Nodes

The following custom nodes are bundled and automatically linked on first run:
Expand Down
48 changes: 47 additions & 1 deletion nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ let
# Template input files (images, audio, etc. for workflow templates)
templateInputs = import ./template-inputs.nix { inherit pkgs; };

# Bundled fonts for custom nodes that require font files
# This provides a pure Nix solution for nodes like ComfyUI_Comfyroll_CustomNodes
# that expect fonts at hardcoded paths like /usr/share/fonts/truetype
bundledFonts = pkgs.symlinkJoin {
name = "comfyui-fonts";
paths = [
pkgs.dejavu_fonts
pkgs.liberation_ttf
pkgs.noto-fonts
pkgs.roboto
];
postBuild = ''
# Create a flat directory with all TTF files for easy access
mkdir -p $out/ttf
find $out/share/fonts -name "*.ttf" -exec ln -sf {} $out/ttf/ \; 2>/dev/null || true
find $out/share/fonts -name "*.TTF" -exec ln -sf {} $out/ttf/ \; 2>/dev/null || true
'';
};

# Import custom nodes for bundling
customNodes = import ./custom-nodes.nix {
inherit
Expand Down Expand Up @@ -298,6 +317,32 @@ let
done
fi

# Create fonts directory with bundled fonts for custom nodes
# This provides fonts for nodes like ComfyUI_Comfyroll_CustomNodes that expect
# fonts at hardcoded paths like /usr/share/fonts/truetype (which doesn't exist on NixOS)
FONTS_DIR="$BASE_DIR/fonts"
mkdir -p "$FONTS_DIR"
# Symlink bundled TTF fonts (only if not already linked)
for font_file in "${bundledFonts}"/ttf/*.ttf "${bundledFonts}"/ttf/*.TTF; do
if [[ -e "$font_file" ]]; then
filename=$(basename "$font_file")
target="$FONTS_DIR/$filename"
if [[ ! -e "$target" ]]; then
ln -sf "$font_file" "$target"
fi
fi
done

# Patch custom nodes that use hardcoded font paths for NixOS compatibility
# ComfyUI_Comfyroll_CustomNodes: patch /usr/share/fonts/truetype -> $BASE_DIR/fonts
COMFYROLL_FONT_FILE="$BASE_DIR/custom_nodes/ComfyUI_Comfyroll_CustomNodes/nodes/nodes_graphics_text.py"
if [[ -f "$COMFYROLL_FONT_FILE" ]]; then
if grep -q '"/usr/share/fonts/truetype"' "$COMFYROLL_FONT_FILE" 2>/dev/null; then
sed -i "s|\"/usr/share/fonts/truetype\"|\"$FONTS_DIR\"|g" "$COMFYROLL_FONT_FILE"
echo "Patched ComfyUI_Comfyroll_CustomNodes for NixOS font compatibility"
fi
fi

# Link our bundled custom nodes
# Remove stale directories if they exist but aren't symlinks
for node_dir in "model_downloader" "ComfyUI-Impact-Pack" "rgthree-comfy" "ComfyUI-KJNodes" "ComfyUI-GGUF" "ComfyUI-LTXVideo" "ComfyUI-Florence2" "ComfyUI_bitsandbytes_NF4" "x-flux-comfyui" "ComfyUI-MMAudio" "PuLID_ComfyUI" "ComfyUI-WanVideoWrapper"; do
Expand Down Expand Up @@ -359,7 +404,8 @@ let
fi

# Create default ComfyUI-Manager config if it doesn't exist
MANAGER_CONFIG_DIR="$BASE_DIR/user/default/ComfyUI-Manager"
# Note: Manager moved config from user/default/ComfyUI-Manager to user/__manager
MANAGER_CONFIG_DIR="$BASE_DIR/user/__manager"
MANAGER_CONFIG="$MANAGER_CONFIG_DIR/config.ini"
if [[ ! -e "$MANAGER_CONFIG" ]]; then
mkdir -p "$MANAGER_CONFIG_DIR"
Expand Down
Loading