Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{stdenv, lib, fetchFromGitHub, ldc ? null, dcompiler ? ldc }: 2 3assert dcompiler != null; 4 5stdenv.mkDerivation rec { 6 pname = "rund"; 7 version = "1.0.0"; 8 9 src = fetchFromGitHub { 10 owner = "dragon-lang"; 11 repo = pname; 12 rev = "v${version}"; 13 sha256 = "10x6f1nn294r5qnpacrpcbp348dndz5fv4nz6ih55c61ckpkvgcf"; 14 }; 15 16 buildInputs = [ dcompiler ]; 17 buildPhase = '' 18 for candidate in dmd ldmd2 gdmd; do 19 echo Checking for DCompiler $candidate ... 20 dc=$(type -P $candidate || echo "") 21 if [ ! "$dc" == "" ]; then 22 break 23 fi 24 done 25 if [ "$dc" == "" ]; then 26 exit "Error: could not find a D compiler" 27 fi 28 echo Using DCompiler $candidate 29 $dc -I=$src/src -i -run $src/make.d build --out $NIX_BUILD_TOP 30 ''; 31 32 doCheck = true; 33 checkPhase = '' 34 $NIX_BUILD_TOP/rund make.d test 35 ''; 36 37 installPhase = '' 38 mkdir -p $out/bin 39 mv $NIX_BUILD_TOP/rund $out/bin 40 ''; 41 42 meta = with lib; { 43 description = "A compiler-wrapper that runs and caches D programs"; 44 homepage = "https://github.com/dragon-lang/rund"; 45 license = lib.licenses.boost; 46 maintainers = with maintainers; [ jonathanmarler ]; 47 platforms = lib.platforms.unix; 48 }; 49}