about summary refs log tree commit diff
path: root/third_party/nix/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-27T21·03+0100
committerVincent Ambo <tazjin@google.com>2020-05-27T23·11+0100
commit25393d80806f7c7caed188130d3f7c9574e61ece (patch)
tree1b62bd0547eca920a845820c8142a7cc1962b6bb /third_party/nix/default.nix
parent3d7537da7fbb37cb043eaa28acc7ffade9bec99d (diff)
refactor(3p/nix): Introduce CMake as the build system for Nix r/868
Completes the switch from Meson to CMake for the core build system in
Nix.

Meson was added originally because someone else had already done the
work for integrating it in Nix and it was an upgrade from the previous
setup.

However over time it became clear that Meson is not quite mature
enough for projects like Nix that have occasionally peculiar
configuration constraints.

Some issues encountered with Meson (some of these are due to the Meson
setup in Nix):

* Difficulty with generating correct compile_commands.json for
  external tools like clangd
* Difficulty linking to libc++ when using clang
* Ugly shell invocations for certain parts of the build system (I want
  these to be gone!!!)

This CMake setup mimics the Meson configuration, but there are some
differences (some temporary):

* headers are now included separately for each library (see a previous
  commit that changes includes appropriately)
* autoheaders-style configuration is currently hardcoded. Before
  blindly copying this I want to evaluate how much of it actually exists
  for portability concerns that I don't have (such as support for OS
  X).
* Nix is built with libc++ by default.
* [libstore] SQL schema is now inlined via a generated header, not an
  included string literal

Abseil is still built as part of this build, rather than an external
dependency, because it chokes on differently configured compiler
invocations.

Note that because of the move to libc++ an unwanted behaviour is
introduced: glog log messages no longer have a body. I have yet to
debug what is going on there.
Diffstat (limited to 'third_party/nix/default.nix')
-rw-r--r--third_party/nix/default.nix18
1 files changed, 3 insertions, 15 deletions
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index 3c7fa4cdb7..aa2fd3b7af 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -2,8 +2,6 @@
 , buildType ? "release", ... }:
 
 let
-  stdenv = with pkgs; overrideCC clangStdenv clang_10;
-
   aws-s3-cpp = pkgs.aws-sdk-cpp.override {
     apis = ["s3" "transfer"];
     customMemoryManagement = false;
@@ -14,22 +12,20 @@ let
   largeBoehm = pkgs.boehmgc.override {
     enableLargeConfig = true;
   };
-in stdenv.mkDerivation {
+in pkgs.llvmPackages.libcxxStdenv.mkDerivation {
   pname = "tazjix";
   version = "2.3.4";
   src = ./.;
 
-  # Abseil's sources need to be linked into a subproject.
+  # Abseil's sources need to be symlinked into Nix' sources.
   postUnpack = ''
-    ln -fs ${pkgs.abseil_cpp.src} nix/subprojects/abseil_cpp
+    ln -fs ${pkgs.abseil_cpp.src} nix/abseil_cpp
   '';
 
   nativeBuildInputs = with pkgs; [
     bison
     clang-tools
     cmake
-    meson
-    ninja
     pkgconfig
     libxml2
     libxslt
@@ -56,14 +52,6 @@ in stdenv.mkDerivation {
     xz
   ];
 
-  mesonBuildType = buildType;
-  mesonFlags = [
-    "-Dsandbox_shell=${pkgs.busybox-sandbox-shell}/bin/busybox"
-  ];
-
-  # cmake is only included to build Abseil and its hook should not run
-  dontUseCmakeConfigure = true;
-
   # Install the various symlinks to the Nix binary which users expect
   # to exist.
   postInstall = ''