Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1if [ -e .attrs.sh ]; then source .attrs.sh; fi 2set -x 3 4export NIX_DEBUG=1 5 6source $stdenv/setup 7 8export NIX_ENFORCE_PURITY=1 9 10mkdir $out 11mkdir $out/bin 12 13cat > hello.c <<EOF 14#include <stdio.h> 15 16int main(int argc, char * * argv) 17{ 18 printf("Hello World!\n"); 19 return 0; 20} 21EOF 22 23#gcc -I/nix/store/foo -I /nix/store/foo -I/usr/lib -I /usr/lib hello.c -o $out/bin/hello 24gcc -I`pwd` -L /nix/store/abcd/lib -isystem /usr/lib hello.c -o $out/bin/hello 25 26$out/bin/hello 27 28cat > hello2.cc <<EOF 29#include <iostream> 30 31int main(int argc, char * * argv) 32{ 33 std::cout << "Hello World!\n"; 34 std::cout << VALUE << std::endl; 35 return 0; 36} 37EOF 38 39g++ hello2.cc -o $out/bin/hello2 -DVALUE="1 + 2 * 3" 40 41$out/bin/hello2 42 43ld -v