Skip to content

Nix flake for RuinedFooocus - Enhanced AI image generation

License

Notifications You must be signed in to change notification settings

utensils/ruined-fooocus-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruined-fooocus-nix

A Nix flake for RuinedFooocus - an enhanced AI image generation software with advanced features.

Features

  • Reproducible builds with Nix
  • Automatic GPU detection (NVIDIA CUDA, Apple Silicon MPS, CPU fallback)
  • Persistent data storage in ~/.config/ruinedfooocus
  • Docker images (CPU and CUDA variants)
  • Enhanced UI with multi-style support, wildcards, and more

Quick Start

Run RuinedFooocus directly without installation:

nix run github:utensils/ruined-fooocus-nix

Installation

Using Flakes

Add to your flake.nix:

{
  inputs.ruined-fooocus-nix.url = "github:utensils/ruined-fooocus-nix";
}

Then use the overlay or package:

# Using the overlay
nixpkgs.overlays = [ ruined-fooocus-nix.overlays.default ];

# Or directly reference the package
environment.systemPackages = [ ruined-fooocus-nix.packages.${system}.default ];

Local Development

git clone https://github.com/utensils/ruined-fooocus-nix
cd ruined-fooocus-nix
nix develop  # Enter development shell
nix run      # Run RuinedFooocus

Usage

Command Line Options

# Run with default settings
nix run .

# Open browser automatically when ready
nix run . -- --open

# Use a specific port
nix run . -- --port=7866

# Listen on all interfaces (for network access)
nix run . -- --listen 0.0.0.0

# Use a custom settings file
nix run . -- --settings /path/to/settings.json

# Enable debug logging
nix run . -- --debug

Available Apps

Command Description
nix run Run RuinedFooocus
nix run .#buildDocker Build CPU Docker image
nix run .#buildDockerCuda Build CUDA Docker image
nix run .#update Check for RuinedFooocus updates

Docker

Build and run the Docker image:

# CPU version
nix run .#buildDocker
docker run -p 7865:7865 -v $PWD/data:/data ruinedfooocus:latest

# CUDA version (requires nvidia-container-toolkit)
nix run .#buildDockerCuda
docker run --gpus all -p 7865:7865 -v $PWD/data:/data ruinedfooocus:cuda

Directory Structure

RuinedFooocus stores persistent data in ~/.config/ruinedfooocus:

~/.config/ruinedfooocus/
├── app/              # RuinedFooocus application code
├── venv/             # Python virtual environment
├── models/           # Downloaded models
│   ├── checkpoints/  # Main model files
│   ├── loras/        # LoRA models
│   ├── embeddings/   # Text embeddings
│   ├── controlnet/   # ControlNet models
│   └── ...
└── outputs/          # Generated images

GPU Support

The flake automatically detects your GPU:

  • NVIDIA: Uses CUDA (cu124 by default, configurable via CUDA_VERSION env var)
  • Apple Silicon: Uses MPS acceleration
  • CPU: Falls back to CPU-only mode

Override CUDA version:

CUDA_VERSION=cu121 nix run .

Supported CUDA versions: cu118, cu121, cu124, cpu

Development

Enter Development Shell

nix develop

This provides:

  • Python 3.12 environment
  • Development tools (git, shellcheck, shfmt)
  • Linting tools (ruff, pyright)
  • Nix formatting (nixfmt-rfc-style)

Code Quality

# Run all checks
nix flake check

# Individual checks
nix run .#lint        # Python linting
nix run .#format      # Python formatting
nix run .#type-check  # Type checking
nix run .#check-all   # All Python checks

Updating RuinedFooocus Version

RuinedFooocus is tracked as a flake input, so updating to HEAD is simple:

nix flake update ruinedfooocus-src

Troubleshooting

Port Already in Use

If port 7865 is already in use, the launcher will offer options to:

  1. Open browser to existing instance
  2. Use a different port
  3. Kill the process using the port

CUDA Not Detected

If CUDA isn't detected despite having an NVIDIA GPU:

  1. Ensure NVIDIA drivers are installed
  2. Check that nvidia-smi works
  3. Try setting CUDA_VERSION explicitly

First Run is Slow

The first run downloads:

  • Python dependencies
  • PyTorch with appropriate GPU support
  • Base models (automatically on first generation)

Subsequent runs use cached dependencies.

Log Button Shows "File not allowed"

This issue is now handled automatically by the flake. The launcher sets the path_outputs environment variable to bypass Gradio's symlink security restrictions.

If you still encounter {"detail":"File not allowed: .../log.html"}, manually edit ~/.config/ruinedfooocus/app/config.txt:

"path_outputs": "/home/YOUR_USER/.config/ruinedfooocus/outputs"

Change from .../app/outputs to the real path (without the app/ symlink), then restart RuinedFooocus.

License

The packaging code (Nix expressions, shell scripts) is licensed under the MIT License. See LICENSE for details.

RuinedFooocus itself is licensed under GPL-3.0 - see the RuinedFooocus repository for details.

Acknowledgments

About

Nix flake for RuinedFooocus - Enhanced AI image generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 2

  •  
  •