Conan2 on NixOS is a disaster

Hi!

I’ve been using NixOS for more than a year now, happy with how all works, and recently got into deploying NixOS on Digital Ocean using flakes and deploy-rs.

Started a project in C++, I’m relatively inexperience with C++. Heard about conan and wanted to use it to make it easy for me to download and compile dependencies for my project and so far is a pain:

  • joltphysics/3.0.1 insists on fetching CMake 3.30.5 despite my default profile specifying conan must use my installed CMake (granted, it is version 3.29.2, but still) making the build fail because the “NixOS cannot run dynamically linked executables intended for generic linux environments out of the box” thing.
  • wayland/1.22.0 finds my CMake, but insists on using a conan-provided pkg-config despite my system offering one already and regardless of what my default profile says.

This is my default profile:

[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux

[platform_tool_requires]
cmake/*
pkgconf/*

This is my project’s conanfile.txt

[requires]
eastl/3.21.12
diligent-core/api.252009
joltphysics/3.0.1

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

The packages attribute of my flake.nix default shell:

    pkgs.mkShell {
            # Pinned packages available in the environment
            packages =
              with pkgs;
              [
                cmake
                cmake-format
                cmake-language-server
                headache
                just
                nil
                unstablepkgs.conan # get's me the latest conan

                gcc14Stdenv
                libGL.dev
                libuuid.dev
                pkg-config
                xcb-util-cursor.dev
                xkeyboard_config
                xorg.libICE.dev
                xorg.libSM.dev
                xorg.libX11.dev
                xorg.libXScrnSaver
                xorg.libXau.dev
                xorg.libXaw.dev
                xorg.libXcomposite.dev
                xorg.libXcursor.dev
                xorg.libXdamage.dev
                xorg.libXdmcp.dev
                xorg.libXext.dev
                xorg.libXi.dev
                xorg.libXinerama.dev
                xorg.libXpm.dev
                xorg.libXrandr.dev
                xorg.libXres.dev
                xorg.libXtst
                xorg.libXv.dev
                xorg.libXxf86vm.dev
                xorg.libfontenc
                xorg.libxkbfile.dev
                xorg.xcbutil.dev
                xorg.xcbutilimage.dev
                xorg.xcbutilkeysyms.dev
                xorg.xcbutilrenderutil.dev
                xorg.xcbutilwm.dev
              ]

Install the dependencies with conan install conanfile.txt --build=missing

I don’t understand the point of having tools like conan if they aren’t well-supported to be used on NixOS or if they aren’t willing to fail if a setting is not respected.