Getting Libraries Working Correctly in Nix Shell

I am trying to run a mokuro (GitHub - kha-white/mokuro: Read Japanese manga inside browser with selectable text.) in a nix shell. I have been fighting with it for a while, and feel like I’m doing something wrong.

Here is my nix shell;


with pkgs;

mkShell {
  shellHook = ''
    export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.libGL}/lib:${pkgs.glib}/lib:$LD_LIBRARY_PATH"
  '';

  buildInputs = [
    python3
    python311Packages.numpy
    zlib
    gcc
    stdenv
    libGL
    glib
  ];
}

Currently I run it, see what library is missing, search what package contains it online, add it, it doesn’t work, add the env var, it works most of the time (libgthread still not found with glib env var, not sure what’s up with that or where to go from here) and this just seems terribly annoying for something I would think would be simple, so I feel like I am doing something horribly wrong.

I don’t have much experience using nix while developing a project, so I can’t help much with setting up a devShell, but I do have experience with packaging for nixpkgs.
I tried to package mokuro and opened a PR: mokuro: init at 0.1.8 by TomaSajt · Pull Request #311731 · NixOS/nixpkgs · GitHub
Let me know if it works for you

3 Likes

this works! thank you!