A Nix flake for RuinedFooocus - an enhanced AI image generation software with advanced 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
Run RuinedFooocus directly without installation:
nix run github:utensils/ruined-fooocus-nixAdd 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 ];git clone https://github.com/utensils/ruined-fooocus-nix
cd ruined-fooocus-nix
nix develop # Enter development shell
nix run # Run RuinedFooocus# 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| 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 |
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:cudaRuinedFooocus 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
The flake automatically detects your GPU:
- NVIDIA: Uses CUDA (cu124 by default, configurable via
CUDA_VERSIONenv 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
nix developThis provides:
- Python 3.12 environment
- Development tools (git, shellcheck, shfmt)
- Linting tools (ruff, pyright)
- Nix formatting (nixfmt-rfc-style)
# 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 checksRuinedFooocus is tracked as a flake input, so updating to HEAD is simple:
nix flake update ruinedfooocus-srcIf port 7865 is already in use, the launcher will offer options to:
- Open browser to existing instance
- Use a different port
- Kill the process using the port
If CUDA isn't detected despite having an NVIDIA GPU:
- Ensure NVIDIA drivers are installed
- Check that
nvidia-smiworks - Try setting
CUDA_VERSIONexplicitly
The first run downloads:
- Python dependencies
- PyTorch with appropriate GPU support
- Base models (automatically on first generation)
Subsequent runs use cached dependencies.
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.
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.
- RuinedFooocus by runew0lf