IncludeOS icon indicating copy to clipboard operation
IncludeOS copied to clipboard

Working nix-shell - a bit convoluted but allows quick iteration.

Open alfreb opened this issue 1 year ago • 1 comments

I've been trying to make a nix shell that can take an IncludeOS package directly from a cmake install as input, to allow fast iteration on OS features, that link into a bootable, without having to rebuild the OS every time.

  • shell.nix is working to the point where cmake configure step finds the right versions of libcxx, libcxxabi, liunwind and musl, but compilation doesn't pick up the right clang by default. I hack it in by defining $CXX, but then it doesn't find libcxx, so c++ includes like <string> are unavailable.

  • shell_overlay.nix is a little simpler, where the idea was to expose the paths to the link time dependencies from pkgsIncludeOS. It has the same result - I get to the point where I think I can link, but I can't compile the bootable binary due to missing includes.

How can we make the nix shell use the same stdenv as nix-build?

alfreb avatar May 19 '24 10:05 alfreb

Rebased. This works for me now - thanks @MagnusS for finding the right compiler! I've kept the old branch with the shell_overlay.nix and the attempts at moving the link time dependencies to the overlay in https://github.com/alfreb/IncludeOS/tree/nix-shell-overlay in case we want to revisit that idea. But this works and I think it can be merged, although the workflow is quite convoluted. Once you're in the two nix-shells development is pretty fast though, which was the objective.

alfreb avatar May 20 '24 06:05 alfreb

Perhaps we could use substituteInPlace to replace the paths we need in the make files directly. See the solo5 example in https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview-example. If we substitute the paths to point to the right location in cmake/os.cmake during postInstall we wouldn't have to specify them everywhere.

MagnusS avatar May 20 '24 22:05 MagnusS