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