summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
blob: 227a8c59985cd672492f6360d62a0658c3190be0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
{ runCommand, cctools }:
{ haskellPackages, src, deps ? p : [], name }: let
  inherit (haskellPackages) ghc ghcWithPackages;
  with-env = ghcWithPackages deps;
  ghcName = "${ghc.prefix}ghc";
in runCommand name { buildInputs = [ with-env cctools ]; } ''
  mkdir -p $out/lib
  mkdir -p $out/include
  ${ghcName} ${src} -staticlib -outputdir . -o $out/lib/${name}.a -stubdir $out/include
  for file in ${ghc}/lib/${ghcName}-${ghc.version}/include/*; do
    ln -sv $file $out/include
  done
''