summaryrefslogtreecommitdiff
path: root/pkgs/development/compilers/microhs/test-hello-world.nix
blob: 8b1f1603cb79392a97087081ef04fb146a26f445 (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
{
  stdenv,
  microhs,
  writeTextDir,
}:

stdenv.mkDerivation {
  name = "microhs-hello-world";
  buildInputs = [ microhs ];

  src = writeTextDir "helloworld.hs" ''
    main :: IO ()
    main = putStrLn "Hello World"
  '';

  buildPhase = ''
    runHook preBuild
    mhs helloworld.hs -oExe
    runHook postBuild
  '';

  checkPhase = ''
    runHook preCheck
    ./Exe | grep "Hello World"
    runHook postCheck
  '';
  doCheck = true;

  installPhase = ''
    runHook preInstall
    touch $out
    runHook postInstall
  '';
}