1{ lib, stdenv
2, fetchFromGitHub
3, zlib
4}:
5
6let
7 version = "0.9";
8 tag = "v${version}";
9 rev = "15773561e40ca5c8cffe0a618c544b6cfdc5ad7e";
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 = "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2";
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 '';
29
30 strictDeps = true;
31 buildInputs = [ zlib ];
32 enableParallelBuilding = true;
33
34 installPhase = ''
35 runHook preInstall
36 mkdir -p $out/bin
37 cp bin/mrustc $out/bin
38 runHook postInstall
39 '';
40
41 meta = with lib; {
42 description = "Mutabah's Rust Compiler";
43 longDescription = ''
44 In-progress alternative rust compiler, written in C++.
45 Capable of building a fully-working copy of rustc,
46 but not yet suitable for everyday use.
47 '';
48 inherit (src.meta) homepage;
49 license = licenses.mit;
50 maintainers = with maintainers; [ progval r-burns ];
51 platforms = [ "x86_64-linux" ];
52 };
53}