Ncurses installed but Dotnet C# still can't see

I’m trying to build console app with a framework that uses Curses and I’m getting this error:
Error loading native library ","

I’ve tried using nix-index and nix-locate to find these libraries and they are present in ncurses package. But adding it to shell packages doesn’t help. The only thing that did help was building FHS environment.
Please help me understand is that a problem with something I’m doing or with how ncurses or dotnet are packaged. Whichever that is can I do something to avoid using buildFHSEnv (since it won’t work on certain machines)?

Here’s everything to reproduce the error I’m getting


<Project Sdk="Microsoft.NET.Sdk">


using Unix.Terminal;


inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
outpus = inputs:
  system = "x86_64-linux";
  pkgs = import inputs.nixpkgs { inherit system; };
  devShells.${system}.default = pkgs.mkShell {
    name = "dotnet-env";
    packages = [
      pkgs.dotnet-sdk_8 # or:
      #  pkgs.dotnetCorePackages.sdk_8_0
      pkgs.ncurses # or:

I started this topic first and very soon after found out about LD_LIBRARY_PATH.
Setting it in shell hook helped - application starts.

shellHook = ''
    export LD_LIBRARY_PATH="${pkgs.ncurses}/lib:$LD_LIBRARY_PATH"

But also there seems to be some concerns about this variable - it can impact linker performance, it can mess up other dynamically linked binaries and even be a security issue. Perhaps when used with care it’s not bad but still, is there a better way?

Also since Curses comes from Unix.Terminal and that is a part of dotnet shouldn’t linking be handled in dotnet nix package?

Does it use hardcoded paths to find them or pkg-config? The first will not work on nixos.