"boost no found" Building a meson project with boost dependency

I’m trying to build a C++ project using the meson build system but it’s having trouble building it as it can’t find boost

flake.nix

{
  description = "A build for <> on NixOS";

  inputs = {
	nixpkgs.url = "nixpkgs/nixos-22.11";
	flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }: 
	flake-utils.lib.eachDefaultSystem (system: let
	  pkgs = import nixpkgs { inherit system; };
    in {
		packages = {
		default = pkgs.stdenv.mkDerivation {
			name = "project";
			src = ./.;
			
			nativeBuildInputs = with pkgs; [
				pkg-config
				meson
				ninja
				cmake
			];

			buildInputs = with pkgs; [
				boost18x
				pipewire
				opencv
				openssl
				ffmpeg
				SDL2
				openxr-loader
				zlib
			];
		};
	  };
    });
}

The relevant part of the meson.build

boost = dependency(
    'boost',
    modules: ['system', 'log', 'log_setup', 'thread', 'unit_test_framework'],
)

But when I call nix run I get this as an error

       last 10 log lines:
       > Host machine cpu: x86_64
       > Library rt found: YES
       > Library dl found: YES
       > Run-time dependency threads found: YES
       > Found pkg-config: /nix/store/kkxx963z7a6ihb3xhvxlqaziyb18zc84-pkg-config-wrapper-0.29.2/bin/pkg-config (0.29.2)
       > Run-time dependency Boost (missing: log, log_setup, system, thread, unit_test_framework) found: NO (tried system)
       >
       > meson.build:34:0: ERROR: Dependency "boost" not found, tried system
       >
       > A full log can be found at /build/na32db13m9yqwgsmsjj7plbbb7pivh54-source/build/meson-logs/meson-log.txt
       For full logs, run 'nix log /nix/store/v2hin2i6l2mhcw9zbl58vb9vbn0p3qk0-module-GC.drv'.

I’m new to nix and NixOS and am trying to figure this all out. Thanks!

Maybe the following is still necessary?

https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-620155616

So this is correct, Meson no longer able to pick up Boost · Issue #86131 · NixOS/nixpkgs · GitHub. It works without the modules section, however I can’t get the environment variables working in the flake. If it put them in the mkDerivation section I get error: attribute 'lib' missing or right after that it still can’t find boost

lib is inside pkgs.

Thank you it now works, however as mentioned in the thread on github, is that something that’s going to be solved via the boost package at some point?

If someone decides to work on it, sure.