1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix

14 lines
497 B
Nix

{ runCommand, cctools }:
{ haskellPackages, src, deps ? p : [], name }: let
inherit (haskellPackages) ghc ghcWithPackages;
with-env = ghcWithPackages deps;
ghcName = "${ghc.targetPrefix}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
''