Skip to content

Instantly share code, notes, and snippets.

@daniel-j-h
Created July 7, 2016 22:47
Show Gist options
  • Save daniel-j-h/9a899c1a9fbe5d867f289aba2fcc47e4 to your computer and use it in GitHub Desktop.
Save daniel-j-h/9a899c1a9fbe5d867f289aba2fcc47e4 to your computer and use it in GitHub Desktop.
Nix C++ compiler, CMake, Boost skeleton --- stable ABI
# Nix skeleton for compiler, cmake, boost.
# Dependencies (boost and others you specify) are getting built with selectec compiler (for ABI compatibility).
# Examples:
# nix-shell --argstr compiler gcc5 --run 'mkdir build && cd build && cmake .. && cmake --build .'
# nix-shell --argstr compiler gcc6 --run 'mkdir build && cd build && cmake .. && cmake --build .'
# nix-shell --argstr compiler clang_38 --run 'mkdir build && cd build && cmake .. && cmake --build .'
{ nixpkgs ? import <nixpkgs> {}, compiler ? "gcc6" }:
let
stdenv = nixpkgs.overrideCC nixpkgs.stdenv nixpkgs.${compiler};
pkgs = nixpkgs.overridePackages (self: super: {
boost = super.boost.override { stdenv = stdenv; };
});
in rec {
myProject = stdenv.mkDerivation {
name = "myProject";
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = [ pkgs.boost ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment