Context:
I’m trying to set up and run fooocus (a platform that runs AI models locally to generate images) on my machine, with NixOS 24.11 (Vicuna) as per the instructions available in their README.
What I’ve done so far:
The instructions are basically, clone the repo, create a virtual environment, install depedencies, and run a script. After some hacking, I realized I needed a python version between 3.10 and 3.11 to run it successfully. I decided to use a shell.nix file to try and make sure things are reproducible, and isolated to a degree.
The Error I Keep Running Into:
However, I kept running into a certain error as I tried to run the script: ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory. After much googling (I’m new to Nix and NixOS, so apologies if I’m trying things that don’t make sense) I managed to figure out that meant that the nix shell created doesn’t have access to the C++ development tools. So, I made some modifications to the shell.nix file, and I now have the following:
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-24.11.tar.gz";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShell {
packages = with pkgs; [
pkgs.llvmPackages_16.libcxxClang
pkgs.python310Full
];
shellHook = ''
# fixes libstdc++ issues and libgl.so issues
LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/
# fixes xcb issues :
# QT_PLUGIN_PATH=${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
'';
}
This is cobbled together from various posts I found online. I commented out the QT_PLUGIN_PATH line, because that’s irrelevant to the problem at hand. What I am running into is an error whenever I try to invoke nix-shell, which is:
error: undefined variable 'stdenv'
at /mnt/store/Projects/Fooocus/shell.nix:13:23:
12| # fixes libstdc++ issues and libgl.so issues
13| LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/
| ^
14| # fixes xcb issues :
And now I’m unsure what to do. I thought stdenv got installed with llvmPackages_16.libcxxClang. Or am I making an incorrect assumption? And will this solve the original problem of the missing compilation tools? I run into the exact same error when attempting to run stable-diffusion-webui as well.
Any help would be much appreciated!!