summaryrefslogtreecommitdiff
path: root/pkgs/development/tools/haskell/microcabal/common.nix
blob: bbe7773fbfa72cc169cdfb930ccc2e6071914c48 (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
62
63
64
65
66
67
68
69
{
  version,
  rev,
  hash,
}:

{
  lib,
  microhs,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
}:

stdenv.mkDerivation {
  pname = "microcabal-stage1";
  inherit version;

  src = fetchFromGitHub {
    owner = "augustss";
    repo = "MicroCabal";
    inherit rev hash;
  };

  patches = [
    (fetchpatch {
      # https://github.com/augustss/MicroCabal/pull/23
      name = "remove-mtl-mhs-override.patch";
      url = "https://github.com/AlexandreTunstall/MicroCabal/commit/ad30461aaf3dd295f4f5cf5db12635e42557cbfa.patch";
      hash = "sha256-Gmlt76C19ZtCHpKyNim0ggtjXnVuq5F0ywvX8BW15uM=";
    })
    (fetchpatch {
      # https://github.com/augustss/MicroCabal/pull/34
      name = "package-install-path.patch";
      url = "https://github.com/augustss/MicroCabal/commit/dc358bbab312e1788564fbb36f835347c21792c0.patch";
      hash = "sha256-aUQwuyp+ihXZ9PeSCqGUylcvzA6/ktZyeyBXiEoVY54=";
    })
    (fetchpatch {
      # https://github.com/augustss/MicroCabal/pull/34
      name = "package-search-path.patch";
      url = "https://github.com/augustss/MicroCabal/commit/3898e5f0596a7391818a0a2cfa994317cda62479.patch";
      hash = "sha256-76yEUpzH5xZZt3U+BCSqyWsImfpOEowupd5YCaYVTO0=";
    })
  ];

  makeFlags = [
    "MHS=${microhs}/bin/mhs"
    "MHSDIR=${microhs}/lib/mhs"
  ];

  installPhase = ''
    runHook preInstall
    install -m755 -d $out/bin
    install -m755 bin/mcabal $out/bin/mcabal
    runHook postInstall
  '';

  meta = {
    description = "A partial Cabal replacement";
    longDescription = ''
      A portable subset of the Cabal functionality.
    '';
    homepage = "https://github.com/augustss/MicroCabal";
    license = lib.licensesSpdx."Apache-2.0";
    mainProgram = "mcabal";
    maintainers = with lib.maintainers; [ AlexandreTunstall ];
    platforms = lib.platforms.all;
  };
}