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