1{ lib, stdenv
2, fetchFromGitHub
3, zlib
4}:
5
6let
7 version = "0.10";
8 tag = "v${version}";
9 rev = "b364724f15fd6fce8234ad8add68107c23a22151";
10in
11
12stdenv.mkDerivation rec {
13 pname = "mrustc";
14 inherit version;
15
16 # Always update minicargo.nix and bootstrap.nix in lockstep with this
17 src = fetchFromGitHub {
18 owner = "thepowersgang";
19 repo = "mrustc";
20 rev = tag;
21 sha256 = "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0";
22 };
23
24 postPatch = ''
25 sed -i 's/\$(shell git show --pretty=%H -s)/${rev}/' Makefile
26 sed -i 's/\$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/${tag}/' Makefile
27 sed -i 's/\$(shell git diff-index --quiet HEAD; echo $$?)/0/' Makefile
28 sed '1i#include <limits>' -i src/trans/codegen_c.cpp
29 '';
30
31 strictDeps = true;
32 buildInputs = [ zlib ];
33 enableParallelBuilding = true;
34
35 installPhase = ''
36 runHook preInstall
37 mkdir -p $out/bin
38 cp bin/mrustc $out/bin
39 runHook postInstall
40 '';
41
42 meta = with lib; {
43 description = "Mutabah's Rust Compiler";
44 longDescription = ''
45 In-progress alternative rust compiler, written in C++.
46 Capable of building a fully-working copy of rustc,
47 but not yet suitable for everyday use.
48 '';
49 inherit (src.meta) homepage;
50 license = licenses.mit;
51 maintainers = with maintainers; [ progval r-burns ];
52 platforms = [ "x86_64-linux" ];
53 };
54}