I apologize in advance if this question has been answered before, but I’m still a noob to nixos.
TLDR: Is there a way to make header and ‘so’ files “available” (expose them) to other programs?
The files are there in the store files, I just can’t find a way to point the compiler to them outside of manually writing the store path.
I’m trying to set up my system for development, specifically for C/C++, and I am having trouble with system libraries (like OpenGL, X11 etc)
I am using vscode, with the default cmake and cmake-tools extensions to build things, as I’ve always used successfully on multiple other distros.
But anywhere I include X11/X.h (or other system libraries for that matter), the compiler can’t find it.
I’ve tried multiple solutions:
First, I tried to just plainly add the libraries to my configuration:
environment.systemPackages = with pkgs; [
...
xorg.libX11
libGL
...
];
Then, I tried making a nix shell to run vsode in:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
xorg.libX11
libGL
];
}
But then I kind of lost the thread, and I found the amount of information a little overwhelming as a beginner with.
I understand that the philosophy of nixos goes against everything being dumped into a single bin, lib, or include folder, but there has to be a way of doing this.
I also tried to use system.extraDependencies
to set those folders, kind of like this:
system.extraDependencies = [
"${pkgs.xorg.libX11.dev}/include"
...
];
I’m sure the solution is simpler than I think, and I just misunderstand how some of the tools in nixos work, or I’m missing a magic option to make these required files available.
I would also prefer if I was able to make these files available system-wide, instead of just in a shell or environment, but not necessarily, I can live with having to open a shell before opening my editor.