Hello,
I’m new to Nix and NixOS. I got through all the nix.dev tutorials and I’m now trying to apply nix to my own project. I’m using CMake and it’s find_package
function to find installed packages on my system. I thought that it should be as easy as adding my dependencies to either the packages
attribute in the mkShell
or to buildInputs
if im trying to build my package with mkDeviation
. But I had no success on either. The packages i tried it with was eigen and nlopt.
My current idea is to create a develop environment with nix, the following dev.nix
file is how i thought i might achive that, but so far no success. This file gets called from default.nix
via pkgs.callPackage
{
mkShell,
lib,
cmake,
ninja,
nlopt,
}:
mkShell {
NAME = "mog-slam";
VERSION = "0.1.0";
packages = [
cmake
ninja
nlopt
];
shellHook = ''
echo "Building $NAME $VERSION with"
echo -n "- GCC "
gcc --version | grep -oP '\d+\.\d+\.\d+'
echo -n "- CMake "
cmake --version | grep -oP '\d+\.\d+\.\d+'
echo -n "- ninja "
ninja --version | grep -oP '\d+\.\d+\.\d+'
'';
}
Thanks for your help.