cleverca22
3/23/2017 - 11:07 PM

nix lua

nix lua

{ clangStdenv, stdenv, protobuf, libressl, lua, libevent, protos }:

let
  lib = stdenv.lib;
  filter = name: type: let baseName = baseNameOf (toString name); in (
    lib.hasSuffix ".cpp" baseName ||
    lib.hasSuffix ".cc" baseName ||
    lib.hasSuffix ".h" baseName ||
    baseName == "Makefile"
  );
in stdenv.mkDerivation {
  preferLocalBuild = true;
  name = "test-driver";
  buildInputs = [ protobuf libressl lua libevent protos ];
  src = builtins.filterSource filter ./.;
  enableParallelBuilding = true;
  dontStrip = true;
}
test-driver: test-driver.o locking.o funcs.o
	${CXX} $^ -o $@ -g -lssl -lprotobuf -llua -levent_pthreads -levent -levent_openssl -lprotos
%.o: %.cpp
	${CXX} -c -Wall -g -std=c++1z $< -o $@
%.o: %.cc
	${CXX} -c -Wall -g -std=c++1z $< -o $@
test-driver.o: test-driver.cpp test-driver.h locking.h funcs.h
funcs.o: funcs.cpp funcs.h
install: test-driver
	mkdir -p ${out}/bin
	cp test-driver ${out}/bin/