1# Temporarily avoid dependency on dotnetbuildhelpers to avoid rebuilding many times while working on it
2
3{
4 lib,
5 stdenv,
6 fetchFromGitHub,
7 mono,
8 pkg-config,
9 dotnetbuildhelpers,
10 autoconf,
11 automake,
12 which,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "fsharp";
17 version = "4.0.1.1";
18
19 src = fetchFromGitHub {
20 owner = "fsharp";
21 repo = "fsharp";
22 rev = version;
23 sha256 = "sha256-dgTEM2aL8lVjVMuW0+HLc+TUA39IiuBv/RfHYNURh5s=";
24 };
25
26 nativeBuildInputs = [
27 pkg-config
28 autoconf
29 automake
30 ];
31 buildInputs = [
32 mono
33 dotnetbuildhelpers
34 which
35 ];
36
37 configurePhase = ''
38 sed -i '988d' src/FSharpSource.targets
39 substituteInPlace ./autogen.sh --replace "/usr/bin/env sh" "${stdenv.shell}"
40 ./autogen.sh --prefix $out
41 '';
42
43 # Make sure the executables use the right mono binary,
44 # and set up some symlinks for backwards compatibility.
45 postInstall = ''
46 substituteInPlace $out/bin/fsharpc --replace " mono " " ${mono}/bin/mono "
47 substituteInPlace $out/bin/fsharpi --replace " mono " " ${mono}/bin/mono "
48 substituteInPlace $out/bin/fsharpiAnyCpu --replace " mono " " ${mono}/bin/mono "
49 ln -s $out/bin/fsharpc $out/bin/fsc
50 ln -s $out/bin/fsharpi $out/bin/fsi
51 for dll in "$out/lib/mono/4.5"/FSharp*.dll
52 do
53 create-pkg-config-for-dll.sh "$out/lib/pkgconfig" "$dll"
54 done
55 '';
56
57 # To fix this error when running:
58 # The file "/nix/store/path/whatever.exe" is an not a valid CIL image
59 dontStrip = true;
60
61 meta = {
62 description = "Functional CLI language";
63 homepage = "https://fsharp.org/";
64 license = lib.licenses.asl20;
65 maintainers = with lib.maintainers; [
66 thoughtpolice
67 raskin
68 ];
69 platforms = with lib.platforms; unix;
70 };
71}