I’m trying to use a dev shell with a C++ dependency but the compiler cannot find the include files.
I’ve already tried adding the dependency to different build inputs instead of just packages.
I’ve tried setting some enviroment variables in the shell hook but alas it hasn’t compiled yet.
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/game.o -c src/game.cpp
src/game.cpp:1:10: fatal error: SFML/Graphics.hpp: No such file or directory
1 | #include <SFML/Graphics.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
scons: *** [src/game.o] Error 1
scons: building terminated because of errors.
The $NIX_CFLAGS_COMPILE variable shows:
-frandom-seed=lxzf700k52 -isystem /nix/store/6gfnx12avg78svzvpxd8dnhhaaxxzy49-sfml-2.5.1/include -isystem /nix/store/901c80rlps5q05bnjk1sj4zaz5k736nc-python3-3.12.7/include -isystem /nix/store/6gfnx12avg78svzvpxd8dnhhaaxxzy49-sfml-2.5.1/include -isystem /nix/store/901c80rlps5q05bnjk1sj4zaz5k736nc-python3-3.12.7/include
And my flake (now just with packages again is this:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
# Flake outputs
outputs = { self, nixpkgs, ... }:
let
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
# Development environment output
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
skim
ripgrep
onefetch
sfml
scons
];
shellHook = ''
onefetch
'';
};
});
};
}