bartman's blog

nixos Fooocus

bartman
Table of Contents

I had Fooocus running on Debian, and I recall it was not trivial to setup.

I am now running NixOS, and wanted to run it again to enhance some images.

Here is how to run dockerized Fooocus app on NixOS (or anywhere, really).

configure docker on nix #

We need to install Nvidia container toolkit, and make sure docker is enabled.

1hardware.nvidia-container-toolkit.enable = true;
2virtualisation.docker = {
3  enable = true;
4  autoPrune.enable = true;
5  enableOnBoot = true;
6};

Optionally allow the port through firewall (for external access)

1networking.firewall.allowedTCPPorts = [ 7865 ];

(then nixos-rebuild switch)

run Fooocus #

1docker run -it --device nvidia.com/gpu=all -p 7865:7865 -v ./models:/fooocus/models -v ./outputs:/fooocus/outputs jamesbrink/fooocus

(it will take some time on the first run)

Tags:
Categories: