Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created March 23, 2017 23:07
Show Gist options
  • Select an option

  • Save cleverca22/33b1552fcab3bd9a7f29a3e1c3ab4f10 to your computer and use it in GitHub Desktop.

Select an option

Save cleverca22/33b1552fcab3bd9a7f29a3e1c3ab4f10 to your computer and use it in GitHub Desktop.
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/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment