summaryrefslogtreecommitdiff
path: root/pkgs/development/compilers/microhs/stage2.nix
blob: fa8b9d3640f3c8e59628b9711e43ae27665e1ac0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  args,
  cpphs,
  microcabal-stage1,
  microhs-stage1,
  stdenv,
  callPackage,
}:

stdenv.mkDerivation (
  finalAttrs:
  let
    args' = args finalAttrs;
    haskellCompilerName = "mhs-${args'.version}";
  in
  args'
  // {
    pname = "microhs";

    nativeBuildInputs = [
      microcabal-stage1
      microhs-stage1
    ];

    env = {
      CABALDIR = "${placeholder "out"}/lib/mcabal";
    };

    dontBuild = true;

    installPhase = ''
      runHook preInstall

      pushd lib
      mcabal -v install
      popd
      mcabal -v install

      mkdir -p $out/bin
      ln -s ../lib/mcabal/bin/mhs $out/bin/mhs

      runHook postInstall
    '';

    passthru = {
      inherit
        haskellCompilerName
        cpphs
        microcabal-stage1
        microhs-stage1
        ;
      targetPrefix = "";
      isMhs = true;
      usesHugs = false;

      tests = {
        hello-world = callPackage ./test-hello-world.nix { microhs = finalAttrs.finalPackage; };
      };
    };
  }
)