summary refs log tree commit diff
diff options
context:
space:
mode:
authorobadz <dav-github@odav.org>2015-05-22 14:25:02 +0100
committerobadz <dav-github@odav.org>2015-06-06 09:06:22 -0400
commitd4681bf62672083f92545e02e00b8cf040247e8d (patch)
tree24f50b3dfad442cf340db277740ec2e7fe0b7239
parent4cf3596fdae5982b5c549c52977662ace7bff26a (diff)
downloadnixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.tar
nixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.tar.gz
nixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.tar.bz2
nixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.tar.lz
nixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.tar.xz
nixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.tar.zst
nixpkgs-d4681bf62672083f92545e02e00b8cf040247e8d.zip
Lay down the foundation for packaging the .NET echosystem
- fetchNuGet can fetch binaries from nuget servers
- buildDotnetPackage can build .NET packages using mono/xbuild
  - Places nuget & paket as they would clash with nix
  - Patch project files because F# targets are expected to be found in
    the mono directory (and we know that's not going to happen on nix)
  - Find DLLs that were copied from buildInputs and replace by symlink
    for sharing
  - Export produced DLL via the pkg-config mechanism
  - Create wrappers for produced EXEs
- Repackaged this new infrastructure: keepass, monodevelop
- Newly packaged: ExtCore, UnionArgParser, FSharp.Data, Paket, and a
  bunch more..

This is a combination of 73 commits.
-rw-r--r--pkgs/applications/editors/monodevelop/default.nix77
-rw-r--r--pkgs/applications/editors/monodevelop/git-revert-12d610fb3f6dce121df538e36f21d8c2eeb0a6e3.patch57
-rw-r--r--pkgs/applications/misc/keepass/default.nix30
-rw-r--r--pkgs/applications/misc/keepass/keepass.patch89
-rw-r--r--pkgs/build-support/build-dotnet-package/default.nix109
-rw-r--r--pkgs/build-support/dotnetbuildhelpers/create-pkg-config-for-dll.sh23
-rw-r--r--pkgs/build-support/dotnetbuildhelpers/default.nix18
-rw-r--r--pkgs/build-support/dotnetbuildhelpers/patch-fsharp-targets.sh20
-rw-r--r--pkgs/build-support/dotnetbuildhelpers/placate-nuget.sh7
-rw-r--r--pkgs/build-support/dotnetbuildhelpers/placate-paket.sh7
-rw-r--r--pkgs/build-support/dotnetbuildhelpers/remove-duplicated-dlls.sh22
-rw-r--r--pkgs/build-support/fetchnuget/default.nix40
-rw-r--r--pkgs/development/compilers/fsharp/default.nix10
-rw-r--r--pkgs/development/compilers/mono/default.nix15
-rw-r--r--pkgs/development/compilers/mono/pkgconfig-before-gac.patch65
-rw-r--r--pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.addin-xml.patch88
-rw-r--r--pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.references.patch43
-rw-r--r--pkgs/development/dotnet-modules/patches/newtonsoft-json.references.patch11
-rw-r--r--pkgs/top-level/all-packages.nix9
-rw-r--r--pkgs/top-level/dotnet-packages.nix495
20 files changed, 1159 insertions, 76 deletions
diff --git a/pkgs/applications/editors/monodevelop/default.nix b/pkgs/applications/editors/monodevelop/default.nix
index b04e37746e0..b27bc75ed59 100644
--- a/pkgs/applications/editors/monodevelop/default.nix
+++ b/pkgs/applications/editors/monodevelop/default.nix
@@ -1,6 +1,7 @@
-{ stdenv, fetchurl, fetchgit
+{ stdenv, fetchurl, fetchgit, fetchNuGet
 , autoconf, automake, pkgconfig, shared_mime_info, intltool
 , glib, mono, gtk-sharp, gnome, gnome-sharp, unzip
+, dotnetPackages
 }:
 
 stdenv.mkDerivation rec {
@@ -13,79 +14,33 @@ stdenv.mkDerivation rec {
     sha256 = "1bgqvlfi6pilj2zxsviqilh63qq98wsijqdiqwpkqchcw741zlyn";
   };
 
-  srcNugetBinary = fetchgit {
-    url = "https://github.com/mono/nuget-binary.git";
-    rev = "da1f2102f8172df6f7a1370a4998e3f88b91c047";
-    sha256 = "1hbnckc4gvqkknf8gh1k7iwqb4vdzifdjd19i60fnczly5v8m1c3";
-  };
-
-  srcNUnit = fetchurl {
-    url = "https://www.nuget.org/api/v2/package/NUnit/2.6.3";
-    sha256 = "0bb16i4ggwz32wkxsh485wf014cqqzhbyx0b3wbpmqjw7p4canph";
-  };
-
-  srcNUnitRunners = fetchurl {
-    url = "https://www.nuget.org/api/v2/package/NUnit.Runners/2.6.3";
-    sha256 = "0qwx1i9lxkp9pijj2bsczzgsamz651hngkxraqjap1v4m7d09a3b";
-  };
-
-  srcNUnit2510 = fetchurl {
+  nunit2510 = fetchurl {
     url = "http://launchpad.net/nunitv2/2.5/2.5.10/+download/NUnit-2.5.10.11092.zip";
     sha256 = "0k5h5bz1p2v3d0w0hpkpbpvdkcszgp8sr9ik498r1bs72w5qlwnc";
   };
 
-  srcNugetSystemWebMvcExtensions = fetchurl {
-    url = https://www.nuget.org/api/v2/package/System.Web.Mvc.Extensions.Mvc.4/1.0.9;
-    sha256 = "19wi662m8primpimzifv8k560m6ymm73z0mf1r8ixl0xqag1hx6j";
-  };
-
-  srcNugetMicrosoftAspNetMvc = fetchurl {
-    url = https://www.nuget.org/api/v2/package/Microsoft.AspNet.Mvc/5.2.2;
-    sha256 = "1jwfmz42kw2yb1g2hgp2h34fc4wx6s8z71da3mw5i4ivs25w9n2b";
-  };
-
-  srcNugetMicrosoftAspNetRazor = fetchurl {
-    url = https://www.nuget.org/api/v2/package/Microsoft.AspNet.Razor/3.2.2;
-    sha256 = "1db3apn4vzz1bx6q5fyv6nyx0drz095xgazqbw60qnhfs7z45axd";
-  };
-
-  srcNugetMicrosoftAspNetWebPages = fetchurl {
-    url = https://www.nuget.org/api/v2/package/Microsoft.AspNet.WebPages/3.2.2;
-    sha256 = "17fwb5yj165sql80i47zirjnm0gr4n8ypz408mz7p8a1n40r4i5l";
-  };
-
-  srcNugetMicrosoftWebInfrastructure = fetchurl {
-    url = https://www.nuget.org/api/v2/package/Microsoft.Web.Infrastructure/1.0.0.0;
-    sha256 = "1mxl9dri5729d0jl84gkpqifqf4xzb6aw1rzcfh6l0r24bix9afn";
-  };
-
   postPatch = ''
     # From https://bugzilla.xamarin.com/show_bug.cgi?id=23696#c19
 
-    # it seems parts of MonoDevelop 5.2+ need NUnit 2.6.4, which isn't included
-    # (?), so download it and put it in the right place in the tree
-    mkdir packages
-    unzip ${srcNUnit} -d packages/NUnit.2.6.3
-    unzip ${srcNUnitRunners} -d packages/NUnit.Runners.2.6.3
-
     # cecil needs NUnit 2.5.10 - this is also missing from the tar
-    unzip -j ${srcNUnit2510} -d external/cecil/Test/libs/nunit-2.5.10 NUnit-2.5.10.11092/bin/net-2.0/framework/\*
+    unzip -j ${nunit2510} -d external/cecil/Test/libs/nunit-2.5.10 NUnit-2.5.10.11092/bin/net-2.0/framework/\*
 
     # the tar doesn't include the nuget binary, so grab it from github and copy it
     # into the right place
-    cp -vfR ${srcNugetBinary}/* external/nuget-binary/
-
-    # AspNet plugin requires these packages
-    unzip ${srcNugetSystemWebMvcExtensions} -d packages/System.Web.Mvc.Extensions.Mvc.4.1.0.9
-    unzip ${srcNugetMicrosoftAspNetMvc} -d packages/Microsoft.AspNet.Mvc.5.2.2
-    unzip ${srcNugetMicrosoftAspNetRazor} -d packages/Microsoft.AspNet.Razor.3.2.2
-    unzip ${srcNugetMicrosoftAspNetWebPages} -d packages/Microsoft.AspNet.WebPages.3.2.2
-    unzip ${srcNugetMicrosoftWebInfrastructure} -d packages/Microsoft.Web.Infrastructure.1.0.0.0
+    cp -vfR "$(dirname $(pkg-config NuGet.Core --variable=Libraries))"/* external/nuget-binary/
   '';
 
+  # Revert this commit which broke the ability to use pkg-config to locate dlls
+  patchFlags = [ "-p2" ];
+  patches = [ ./git-revert-12d610fb3f6dce121df538e36f21d8c2eeb0a6e3.patch ];
+
   buildInputs = [
     autoconf automake pkgconfig shared_mime_info intltool
     mono gtk-sharp gnome-sharp unzip
+    pkgconfig
+    dotnetPackages.NUnit
+    dotnetPackages.NUnitRunners
+    dotnetPackages.Nuget
   ];
 
   preConfigure = "patchShebangs ./configure";
@@ -108,6 +63,12 @@ stdenv.mkDerivation rec {
     > 
     EOF
     done
+
+    # Without this, you get a missing DLL error any time you install an addin..
+    ln -sv `pkg-config nunit.core --variable=Libraries` $out/lib/monodevelop/AddIns/NUnit
+    ln -sv `pkg-config nunit.core.interfaces --variable=Libraries` $out/lib/monodevelop/AddIns/NUnit
+    ln -sv `pkg-config nunit.framework --variable=Libraries` $out/lib/monodevelop/AddIns/NUnit
+    ln -sv `pkg-config nunit.util --variable=Libraries` $out/lib/monodevelop/AddIns/NUnit
   '';
 
   dontStrip = true;
diff --git a/pkgs/applications/editors/monodevelop/git-revert-12d610fb3f6dce121df538e36f21d8c2eeb0a6e3.patch b/pkgs/applications/editors/monodevelop/git-revert-12d610fb3f6dce121df538e36f21d8c2eeb0a6e3.patch
new file mode 100644
index 00000000000..969aad33ec0
--- /dev/null
+++ b/pkgs/applications/editors/monodevelop/git-revert-12d610fb3f6dce121df538e36f21d8c2eeb0a6e3.patch
@@ -0,0 +1,57 @@
+diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
+index 02d3a01..c6daaad 100644
+--- a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
++++ b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
+@@ -452,34 +452,6 @@
+     <None Include="Templates\Projects\WebApplication.xpt.xml">
+       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+     </None>
+-    <None Include="..\..\..\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll">
+-      <Link>System.Web.Mvc.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+-    <None Include="..\..\..\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll">
+-      <Link>System.Web.Razor.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+-    <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.Helpers.dll">
+-      <Link>System.Web.Helpers.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+-    <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Deployment.dll">
+-      <Link>System.Web.WebPages.Deployment.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+-    <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll">
+-      <Link>System.Web.WebPages.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+-    <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Razor.dll">
+-      <Link>System.Web.WebPages.Razor.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+-    <None Include="..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll">
+-      <Link>Microsoft.Web.Infrastructure.dll</Link>
+-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+-    </None>
+     <None Include="packages.config" />
+   </ItemGroup>
+   <ItemGroup>
+diff --git a/main/src/addins/AspNet/Properties/MonoDevelop.AspNet.addin.xml b/main/src/addins/AspNet/Properties/MonoDevelop.AspNet.addin.xml
+index eab7c32..4a75311 100644
+--- a/main/src/addins/AspNet/Properties/MonoDevelop.AspNet.addin.xml
++++ b/main/src/addins/AspNet/Properties/MonoDevelop.AspNet.addin.xml
+@@ -1,13 +1,6 @@
+ <ExtensionModel>

+ 	

+ 	<Runtime>

+-		<Import assembly = "System.Web.Helpers.dll" />
+-		<Import assembly = "System.Web.Mvc.dll" />
+-		<Import assembly = "System.Web.Razor.dll" />
+-		<Import assembly = "System.Web.WebPages.Deployment.dll" />
+-		<Import assembly = "System.Web.WebPages.dll" />
+-		<Import assembly = "System.Web.WebPages.Razor.dll" />
+-
+ 		<Import file = "Html/Schemas/xhtml1-strict.xsd" />

+ 		<Import file = "Html/Schemas/xhtml1-transitional.xsd" />

+ 		<Import file = "Html/Schemas/xhtml1-frameset.xsd" />

diff --git a/pkgs/applications/misc/keepass/default.nix b/pkgs/applications/misc/keepass/default.nix
index d46efc4e5e8..f659e4f6c2d 100644
--- a/pkgs/applications/misc/keepass/default.nix
+++ b/pkgs/applications/misc/keepass/default.nix
@@ -1,17 +1,21 @@
-{ stdenv, fetchurl, unzip, makeDesktopItem, mono }:
+{ stdenv, fetchurl, buildDotnetPackage, makeWrapper, unzip, makeDesktopItem }:
 
-stdenv.mkDerivation rec {
-  name = "keepass-${version}";
+buildDotnetPackage rec {
+  baseName = "keepass";
   version = "2.29";
 
   src = fetchurl {
-    url = "mirror://sourceforge/keepass/KeePass-${version}.zip";
-    sha256 = "16x7m899akpi036c0wlr41w7fz9q0b69yac9q97rqkixb03l4g9d";
+    url = "mirror://sourceforge/keepass/KeePass-${version}-Source.zip";
+    sha256 = "051s0aznyyhbpdbly6h5rs0ax0zvkp45dh93nmq6lwhicswjwn5m";
   };
 
   sourceRoot = ".";
 
-  phases = [ "unpackPhase" "installPhase" ];
+  buildInputs = [ unzip ];
+
+  patches = [ ./keepass.patch ];
+
+  preConfigure = "rm -rvf Build/*";
 
   desktopItem = makeDesktopItem {
     name = "keepass";
@@ -22,23 +26,19 @@ stdenv.mkDerivation rec {
     categories = "Application;Other;";
   };
 
+  outputFiles = [ "Build/KeePass/Release/*" "Build/KeePassLib/Release/*" ];
+  dllFiles = [ "KeePassLib.dll" ];
+  exeFiles = [ "KeePass.exe" ];
 
-  installPhase = ''
-    mkdir -p "$out/bin"
-    echo "${mono}/bin/mono $out/KeePass.exe" > $out/bin/keepass
-    chmod +x $out/bin/keepass
-    echo $out
-    cp -r ./* $out/
+  postInstall = ''
     mkdir -p "$out/share/applications"
     cp ${desktopItem}/share/applications/* $out/share/applications
   '';
 
-  buildInputs = [ unzip ];
-
   meta = {
     description = "GUI password manager with strong cryptography";
     homepage = http://www.keepass.info/;
-    maintainers = with stdenv.lib.maintainers; [amorsillo];
+    maintainers = with stdenv.lib.maintainers; [ amorsillo obadz ];
     platforms = with stdenv.lib.platforms; all;
     license = stdenv.lib.licenses.gpl2;
   };
diff --git a/pkgs/applications/misc/keepass/keepass.patch b/pkgs/applications/misc/keepass/keepass.patch
new file mode 100644
index 00000000000..6ecf0bb074d
--- /dev/null
+++ b/pkgs/applications/misc/keepass/keepass.patch
@@ -0,0 +1,89 @@
+diff -Naur old/KeePass/KeePass.csproj new/KeePass/KeePass.csproj
+--- old/KeePass/KeePass.csproj	2015-04-10 11:00:46.000000000 +0100
++++ new/KeePass/KeePass.csproj	2015-05-27 16:35:52.196177593 +0100
+@@ -1,4 +1,4 @@
+-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">

++<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

+   <PropertyGroup>

+     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

+     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

+@@ -10,7 +10,7 @@
+     <RootNamespace>KeePass</RootNamespace>

+     <AssemblyName>KeePass</AssemblyName>

+     <ApplicationIcon>KeePass.ico</ApplicationIcon>

+-    <SignAssembly>true</SignAssembly>

++    <SignAssembly>false</SignAssembly>

+     <AssemblyOriginatorKeyFile>KeePass.pfx</AssemblyOriginatorKeyFile>

+     <FileUpgradeFlags>

+     </FileUpgradeFlags>

+@@ -1316,6 +1316,5 @@
+   </Target>

+   -->

+   <PropertyGroup>

+-    <PostBuildEvent>"$(FrameworkSDKDir)bin\sgen.exe" /assembly:"$(TargetPath)" /force /nologo /compiler:/keycontainer:VS_KEY_33430356D8D7D1B8 /compiler:/delaysign-</PostBuildEvent>

+   </PropertyGroup>

+-</Project>
+\ No newline at end of file
++</Project>

+diff -Naur old/KeePassLib/KeePassLib.csproj new/KeePassLib/KeePassLib.csproj
+--- old/KeePassLib/KeePassLib.csproj	2014-05-08 15:00:24.000000000 +0100
++++ new/KeePassLib/KeePassLib.csproj	2015-05-27 16:35:52.197177562 +0100
+@@ -1,4 +1,4 @@
+-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">

++<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

+   <PropertyGroup>

+     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

+     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

+@@ -9,7 +9,7 @@
+     <AppDesignerFolder>Properties</AppDesignerFolder>

+     <RootNamespace>KeePassLib</RootNamespace>

+     <AssemblyName>KeePassLib</AssemblyName>

+-    <SignAssembly>true</SignAssembly>

++    <SignAssembly>false</SignAssembly>

+     <AssemblyOriginatorKeyFile>KeePassLib.pfx</AssemblyOriginatorKeyFile>

+     <FileUpgradeFlags>

+     </FileUpgradeFlags>

+diff -Naur old/KeePass.sln new/KeePass.sln
+--- old/KeePass.sln	2009-08-31 19:47:28.000000000 +0100
++++ new/KeePass.sln	2015-05-27 16:35:59.568953518 +0100
+@@ -1,11 +1,9 @@
+-Microsoft Visual Studio Solution File, Format Version 10.00

++Microsoft Visual Studio Solution File, Format Version 12.00

+ # Visual Studio 2008

+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeePassLib", "KeePassLib\KeePassLib.csproj", "{53573E4E-33CB-4FDB-8698-C95F5E40E7F3}"

+ EndProject

+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeePass", "KeePass\KeePass.csproj", "{10938016-DEE2-4A25-9A5A-8FD3444379CA}"

+ EndProject

+-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeePassLibSD", "KeePassLibSD\KeePassLibSD.csproj", "{DC15F71A-2117-4DEF-8C10-AA355B5E5979}"

+-EndProject

+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrlUtil", "Translation\TrlUtil\TrlUtil.csproj", "{B7E890E7-BF50-4450-9A52-C105BD98651C}"

+ EndProject

+ Global

+@@ -44,18 +42,6 @@
+ 		{10938016-DEE2-4A25-9A5A-8FD3444379CA}.Release|Mixed Platforms.Build.0 = Release|Any CPU

+ 		{10938016-DEE2-4A25-9A5A-8FD3444379CA}.Release|Win32.ActiveCfg = Release|Any CPU

+ 		{10938016-DEE2-4A25-9A5A-8FD3444379CA}.Release|x64.ActiveCfg = Release|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Debug|Any CPU.Build.0 = Debug|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Debug|Win32.ActiveCfg = Debug|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Debug|x64.ActiveCfg = Debug|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Release|Any CPU.ActiveCfg = Release|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Release|Any CPU.Build.0 = Release|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Release|Mixed Platforms.Build.0 = Release|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Release|Win32.ActiveCfg = Release|Any CPU

+-		{DC15F71A-2117-4DEF-8C10-AA355B5E5979}.Release|x64.ActiveCfg = Release|Any CPU

+ 		{B7E890E7-BF50-4450-9A52-C105BD98651C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

+ 		{B7E890E7-BF50-4450-9A52-C105BD98651C}.Debug|Any CPU.Build.0 = Debug|Any CPU

+ 		{B7E890E7-BF50-4450-9A52-C105BD98651C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU

+diff -Naur old/Translation/TrlUtil/TrlUtil.csproj new/Translation/TrlUtil/TrlUtil.csproj
+--- old/Translation/TrlUtil/TrlUtil.csproj	2013-07-21 10:06:38.000000000 +0100
++++ new/Translation/TrlUtil/TrlUtil.csproj	2015-05-27 16:35:52.197177562 +0100
+@@ -1,4 +1,4 @@
+-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">

++<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

+   <PropertyGroup>

+     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

+     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

diff --git a/pkgs/build-support/build-dotnet-package/default.nix b/pkgs/build-support/build-dotnet-package/default.nix
new file mode 100644
index 00000000000..00be987af75
--- /dev/null
+++ b/pkgs/build-support/build-dotnet-package/default.nix
@@ -0,0 +1,109 @@
+{ stdenv, lib, makeWrapper, pkgconfig, mono, dotnetbuildhelpers }:
+
+attrsOrig @
+{ baseName
+, version
+, buildInputs ? []
+, xBuildFiles ? [ ]
+, xBuildFlags ? [ "/p:Configuration=Release" ]
+, outputFiles ? [ "bin/Release/*" ]
+, dllFiles ? [ "*.dll" ]
+, exeFiles ? [ "*.exe" ]
+, ... }:
+  let
+    arrayToShell = (a: toString (map (lib.escape (lib.stringToCharacters "\\ ';$`()|<>\t") ) a));
+
+    attrs = {
+      name = "${baseName}-${version}";
+
+      buildInputs = [
+        pkgconfig
+        mono
+        dotnetbuildhelpers
+        makeWrapper
+      ] ++ buildInputs;
+
+      configurePhase = ''
+        runHook preConfigure
+
+        [ -z "$dontPlacateNuget" ] && placate-nuget.sh
+        [ -z "$dontPlacatePaket" ] && placate-paket.sh
+        [ -z "$dontPatchFSharpTargets" ] && patch-fsharp-targets.sh
+
+        runHook postConfigure
+      '';
+
+      buildPhase = ''
+        runHook preBuild
+
+        echo Building dotNET packages...
+
+        # Probably needs to be moved to fsharp
+        if pkg-config FSharp.Core
+        then
+          export FSharpTargetsPath="$(dirname $(pkg-config FSharp.Core --variable=Libraries))/Microsoft.FSharp.Targets"
+        fi
+
+        ran=""
+        for xBuildFile in ${arrayToShell xBuildFiles} ''${xBuildFilesExtra}
+        do
+          ran="yes"
+          xbuild ${arrayToShell xBuildFlags} ''${xBuildFlagsArray} $xBuildFile
+        done
+
+        [ -z "$ran" ] && xbuild ${arrayToShell xBuildFlags} ''${xBuildFlagsArray}
+
+        runHook postBuild
+      '';
+
+      dontStrip = true;
+
+      installPhase = ''
+        runHook preInstall
+
+        target="$out/lib/dotnet/${baseName}"
+        mkdir -p "$target"
+
+        cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target"
+
+        if [ -z "$dontRemoveDuplicatedDlls" ]
+        then
+          pushd "$out"
+          remove-duplicated-dlls.sh
+          popd
+        fi
+
+        set -f
+        for dllPattern in ${arrayToShell dllFiles} ''${dllFilesArray[@]}
+        do
+          set +f
+          for dll in "$target"/$dllPattern
+          do
+            [ -f "$dll" ] || continue
+            if pkg-config $(basename -s .dll "$dll")
+            then
+              echo "$dll already exported by a buildInputs, not re-exporting"
+            else
+              ${dotnetbuildhelpers}/bin/create-pkg-config-for-dll.sh "$out/lib/pkgconfig" "$dll"
+            fi
+          done
+        done
+
+        set -f
+        for exePattern in ${arrayToShell exeFiles} ''${exeFilesArray[@]}
+        do
+          set +f
+          for exe in "$target"/$exePattern
+          do
+            [ -f "$exe" ] || continue
+            mkdir -p "$out"/bin
+            commandName="$(basename -s .exe "$(echo "$exe" | tr "[A-Z]" "[a-z]")")"
+            makeWrapper "${mono}/bin/mono \"$exe\"" "$out"/bin/"$commandName"
+          done
+        done
+
+        runHook postInstall
+      '';
+    };
+  in
+    stdenv.mkDerivation (attrs // (builtins.removeAttrs attrsOrig [ "buildInputs" ] ))
diff --git a/pkgs/build-support/dotnetbuildhelpers/create-pkg-config-for-dll.sh b/pkgs/build-support/dotnetbuildhelpers/create-pkg-config-for-dll.sh
new file mode 100644
index 00000000000..37914170452
--- /dev/null
+++ b/pkgs/build-support/dotnetbuildhelpers/create-pkg-config-for-dll.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+targetDir="$1"
+dllFullPath="$2"
+
+dllVersion="$(monodis --assembly "$dllFullPath" | grep ^Version: | cut -f 2 -d : | xargs)"
+[ -z "$dllVersion" ] && echo "Defaulting dllVersion to 0.0.0" && dllVersion="0.0.0"
+dllFileName="$(basename $dllFullPath)"
+dllRootName="$(basename -s .dll $dllFileName)"
+targetPcFile="$targetDir"/"$dllRootName".pc
+
+mkdir -p "$targetDir"
+
+cat > $targetPcFile << EOF
+Libraries=$dllFullPath
+
+Name: $dllRootName
+Description: $dllRootName
+Version: $dllVersion
+Libs: -r:$dllFileName
+EOF
+
+echo "Created $targetPcFile"
diff --git a/pkgs/build-support/dotnetbuildhelpers/default.nix b/pkgs/build-support/dotnetbuildhelpers/default.nix
new file mode 100644
index 00000000000..ed0d4f790c8
--- /dev/null
+++ b/pkgs/build-support/dotnetbuildhelpers/default.nix
@@ -0,0 +1,18 @@
+{ helperFunctions, mono, pkgconfig }:
+  helperFunctions.runCommand
+    "dotnetbuildhelpers"
+    { preferLocalBuild = true; }
+    ''
+      target="$out/bin"
+      mkdir -p "$target"
+
+      for script in ${./create-pkg-config-for-dll.sh} ${./patch-fsharp-targets.sh} ${./remove-duplicated-dlls.sh} ${./placate-nuget.sh} ${./placate-paket.sh}
+      do
+        scriptName="$(basename "$script" | cut -f 2- -d -)"
+        cp -v "$script" "$target"/"$scriptName"
+        chmod 755 "$target"/"$scriptName"
+        patchShebangs "$target"/"$scriptName"
+        substituteInPlace "$target"/"$scriptName" --replace pkg-config ${pkgconfig}/bin/pkg-config
+        substituteInPlace "$target"/"$scriptName" --replace monodis ${mono}/bin/monodis
+      done
+    ''
diff --git a/pkgs/build-support/dotnetbuildhelpers/patch-fsharp-targets.sh b/pkgs/build-support/dotnetbuildhelpers/patch-fsharp-targets.sh
new file mode 100644
index 00000000000..3f81cc73e80
--- /dev/null
+++ b/pkgs/build-support/dotnetbuildhelpers/patch-fsharp-targets.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Some project files look for F# targets in $(FSharpTargetsPath)
+# so it's a good idea to add something like this to your ~/.bash_profile:
+
+# export FSharpTargetsPath=$(dirname $(which fsharpc))/../lib/mono/4.0/Microsoft.FSharp.Targets
+
+# In build scripts, you would add somehting like this:
+
+# export FSharpTargetsPath="${fsharp}/lib/mono/4.0/Microsoft.FSharp.Targets"
+
+# However, some project files look for F# targets in the main Mono directory. When that happens
+# patch the project files using this script so they will look in $(FSharpTargetsPath) instead.
+
+echo "Patching F# targets in fsproj files..."
+
+find -iname \*.fsproj -print -exec \
+  sed --in-place=.bak \
+    -e 's,<FSharpTargetsPath>\([^<]*\)</FSharpTargetsPath>,<FSharpTargetsPath Condition="Exists('\'\\1\'')">\1</FSharpTargetsPath>,'g \
+    {} \;
diff --git a/pkgs/build-support/dotnetbuildhelpers/placate-nuget.sh b/pkgs/build-support/dotnetbuildhelpers/placate-nuget.sh
new file mode 100644
index 00000000000..8a7f36522a3
--- /dev/null
+++ b/pkgs/build-support/dotnetbuildhelpers/placate-nuget.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+echo Placating Nuget in nuget.targets
+find -iname nuget.targets -print -exec sed --in-place=bak -e 's,mono --runtime[^<]*,true NUGET PLACATED BY buildDotnetPackage,g' {} \;
+
+echo Just to be sure, replacing Nuget executables by empty files.
+find . -iname nuget.exe \! -size 0 -exec mv -v {} {}.bak \; -exec touch {} \;
diff --git a/pkgs/build-support/dotnetbuildhelpers/placate-paket.sh b/pkgs/build-support/dotnetbuildhelpers/placate-paket.sh
new file mode 100644
index 00000000000..0dbf1eecbad
--- /dev/null
+++ b/pkgs/build-support/dotnetbuildhelpers/placate-paket.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+echo Placating Paket in paket.targets
+find -iname paket.targets -print -exec sed --in-place=bak -e 's,mono --runtime[^<]*,true PAKET PLACATED BY buildDotnetPackage,g' {} \;
+
+echo Just to be sure, replacing Paket executables by empty files.
+find . -iname paket\*.exe \! -size 0 -exec mv -v {} {}.bak \; -exec touch {} \;
diff --git a/pkgs/build-support/dotnetbuildhelpers/remove-duplicated-dlls.sh b/pkgs/build-support/dotnetbuildhelpers/remove-duplicated-dlls.sh
new file mode 100644
index 00000000000..d8d29912c8f
--- /dev/null
+++ b/pkgs/build-support/dotnetbuildhelpers/remove-duplicated-dlls.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+IFS="
+"
+
+for dll in $(find -iname \*.dll)
+do
+    baseName="$(basename "$dll" | sed "s/.dll$//i")"
+    if pkg-config "$baseName"
+    then
+        candidateDll="$(pkg-config "$baseName" --variable=Libraries)"
+
+        if diff "$dll" "$candidateDll" >/dev/null
+        then
+            echo "$dll is identical to $candidateDll. Substituting..."
+            rm -vf "$dll"
+            ln -sv "$candidateDll" "$dll"
+        else
+            echo "$dll and $candidateDll share the same name but have different contents, leaving alone."
+        fi
+    fi
+done
diff --git a/pkgs/build-support/fetchnuget/default.nix b/pkgs/build-support/fetchnuget/default.nix
new file mode 100644
index 00000000000..803db27c9d5
--- /dev/null
+++ b/pkgs/build-support/fetchnuget/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, buildDotnetPackage, unzip }:
+
+attrs @
+{ baseName
+, version
+, url ? "https://www.nuget.org/api/v2/package/${baseName}/${version}"
+, sha256 ? ""
+, md5 ? ""
+, ...
+}:
+  buildDotnetPackage ({
+    src = fetchurl {
+      inherit url sha256 md5;
+      name = "${baseName}.${version}.zip";
+    };
+
+    sourceRoot = ".";
+
+    buildInputs = [ unzip ];
+
+    phases = [ "unpackPhase" "installPhase" ];
+
+    preInstall = ''
+      function traverseRename () {
+        for e in *
+        do
+          t="$(echo "$e" | sed -e "s/%20/\ /g" -e "s/%2B/+/g")"
+          [ "$t" != "$e" ] && mv -vn "$e" "$t"
+          if [ -d "$t" ]
+          then
+            cd "$t"
+            traverseRename
+            cd ..
+          fi
+        done
+      }
+
+      traverseRename
+   '';
+  } // attrs)
diff --git a/pkgs/development/compilers/fsharp/default.nix b/pkgs/development/compilers/fsharp/default.nix
index 82742cf9af6..92d80deb532 100644
--- a/pkgs/development/compilers/fsharp/default.nix
+++ b/pkgs/development/compilers/fsharp/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, mono, pkgconfig, autoconf, automake, which }:
+# Temporaririly avoid dependency on dotnetbuildhelpers to avoid rebuilding many times while working on it
+
+{ stdenv, fetchurl, mono, pkgconfig, dotnetbuildhelpers, autoconf, automake, which }:
 
 stdenv.mkDerivation rec {
   name = "fsharp-${version}";
@@ -9,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "16kqgdx0y0lmxv59mc4g7l5ll60nixg5b8bg07vxfnqrf7i6dffd";
   };
 
-  buildInputs = [ mono pkgconfig autoconf automake which ];
+  buildInputs = [ mono pkgconfig dotnetbuildhelpers autoconf automake which ];
   configurePhase = ''
     substituteInPlace ./autogen.sh --replace "/usr/bin/env sh" "/bin/sh"
     ./autogen.sh --prefix $out
@@ -23,6 +25,10 @@ stdenv.mkDerivation rec {
     substituteInPlace $out/bin/fsharpiAnyCpu --replace " mono " " ${mono}/bin/mono "
     ln -s $out/bin/fsharpc $out/bin/fsc
     ln -s $out/bin/fsharpi $out/bin/fsi
+    for dll in "$out/lib/mono/4.5"/FSharp*.dll
+    do
+      create-pkg-config-for-dll.sh "$out/lib/pkgconfig" "$dll"
+    done
   '';
 
   # To fix this error when running:
diff --git a/pkgs/development/compilers/mono/default.nix b/pkgs/development/compilers/mono/default.nix
index ba2ce00cfb5..66939ff1a02 100644
--- a/pkgs/development/compilers/mono/default.nix
+++ b/pkgs/development/compilers/mono/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? true }:
+{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert }:
 
 let
   llvm     = callPackage ./llvm.nix { };
@@ -31,11 +31,16 @@ stdenv.mkDerivation rec {
   # Parallel building doesn't work, as shows http://hydra.nixos.org/build/2983601
   enableParallelBuilding = false;
 
+  # We want pkg-config to take priority over the dlls in the Mono framework and the GAC
+  # because we control pkg-config
+  patches = [ ./pkgconfig-before-gac.patch ];
+
   # Patch all the necessary scripts. Also, if we're using LLVM, we fix the default
   # LLVM path to point into the Mono LLVM build, since it's private anyway.
   preBuild = ''
     makeFlagsArray=(INSTALL=`type -tp install`)
     patchShebangs ./
+    substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share"
   '' + stdenv.lib.optionalString withLLVM ''
     substituteInPlace mono/mini/aot-compiler.c --replace "llvm_path = g_strdup (\"\")" "llvm_path = g_strdup (\"${llvm}/bin/\")"
   '';
@@ -50,6 +55,14 @@ stdenv.mkDerivation rec {
     done
   '';
 
+  # Without this, any Mono application attempting to open an SSL connection will throw with 
+  # The authentication or decryption has failed.
+  # ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server.
+  postInstall = ''
+    echo "Updating Mono key store"
+    $out/bin/cert-sync ${cacert}/etc/ssl/certs/ca-bundle.crt
+  '';
+
   meta = {
     homepage = http://mono-project.com/;
     description = "Cross platform, open source .NET development framework";
diff --git a/pkgs/development/compilers/mono/pkgconfig-before-gac.patch b/pkgs/development/compilers/mono/pkgconfig-before-gac.patch
new file mode 100644
index 00000000000..7632d850391
--- /dev/null
+++ b/pkgs/development/compilers/mono/pkgconfig-before-gac.patch
@@ -0,0 +1,65 @@
+diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets
+--- mono-4.0.1.old/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets	2015-04-24 02:26:18.000000000 +0100
++++ mono-4.0.1/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets	2015-05-26 00:52:33.997847464 +0100
+@@ -229,8 +229,8 @@
+ 			$(ReferencePath);
+ 			@(AdditionalReferencePath);
+ 			{HintPathFromItem};
+-			{TargetFrameworkDirectory};
+ 			{PkgConfig};
++			{TargetFrameworkDirectory};
+ 			{GAC};
+ 			{RawFileName};
+ 			$(OutDir)
+diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets
+--- mono-4.0.1.old/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets	2015-04-24 02:26:18.000000000 +0100
++++ mono-4.0.1/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets	2015-05-26 00:52:41.832612748 +0100
+@@ -214,8 +214,8 @@
+ 			$(ReferencePath);
+ 			@(AdditionalReferencePath);
+ 			{HintPathFromItem};
+-			{TargetFrameworkDirectory};
+ 			{PkgConfig};
++			{TargetFrameworkDirectory};
+ 			{GAC};
+ 			{RawFileName};
+ 			$(OutDir)
+diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets
+--- mono-4.0.1.old/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets	2015-04-24 02:26:18.000000000 +0100
++++ mono-4.0.1/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets	2015-05-26 00:52:46.298478961 +0100
+@@ -139,8 +139,8 @@
+ 			$(ReferencePath);
+ 			@(AdditionalReferencePath);
+ 			{HintPathFromItem};
+-			{TargetFrameworkDirectory};
+ 			{PkgConfig};
++			{TargetFrameworkDirectory};
+ 			{GAC};
+ 			{RawFileName};
+ 			$(OutDir)
+diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets
+--- mono-4.0.1.old/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets	2015-04-24 02:26:18.000000000 +0100
++++ mono-4.0.1/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets	2015-05-26 00:52:52.119304583 +0100
+@@ -167,8 +167,8 @@
+ 			$(ReferencePath);
+ 			@(AdditionalReferencePath);
+ 			{HintPathFromItem};
+-			{TargetFrameworkDirectory};
+ 			{PkgConfig};
++			{TargetFrameworkDirectory};
+ 			{GAC};
+ 			{RawFileName};
+ 			$(OutDir)
+diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets
+--- mono-4.0.1.old/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets	2015-04-24 02:26:18.000000000 +0100
++++ mono-4.0.1/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets	2015-05-26 00:52:56.519172776 +0100
+@@ -229,8 +229,8 @@
+ 			$(ReferencePath);
+ 			@(AdditionalReferencePath);
+ 			{HintPathFromItem};
+-			{TargetFrameworkDirectory};
+ 			{PkgConfig};
++			{TargetFrameworkDirectory};
+ 			{GAC};
+ 			{RawFileName};
+ 			$(OutDir)
diff --git a/pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.addin-xml.patch b/pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.addin-xml.patch
new file mode 100644
index 00000000000..a3b2f87f378
--- /dev/null
+++ b/pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.addin-xml.patch
@@ -0,0 +1,88 @@
+--- fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml.orig.old	2015-06-03 19:53:00.116849746 +0100
++++ fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml.orig	2015-06-03 19:56:30.112579384 +0100
+@@ -130,6 +130,11 @@
+   <!-- New projects will be created with this targets file. -->
+   <Extension path="/MonoDevelop/ProjectModel/MSBuildItemTypes">
+     <!--  If FSharp 3.1 is available, use it. Note XS looks for the first DotNetProject node under 'Extension' -->
++	<Condition id="MSBuildTargetIsAvailable" target="$(FSharpTargetsPath)" >
++        <DotNetProject language="F#" extension="fsproj" guid="{f2a71f9b-5d33-465a-a702-920d77279786}" import="$(FSharpTargetsPath)"  resourceHandler="MonoDevelop.FSharp.FSharpResourceIdBuilder"/>
++	</Condition>
++
++    <!--  If FSharp 3.1 is available, use it. Note XS looks for the first DotNetProject node under 'Extension' -->
+ 	<Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" >
+       <DotNetProject language="F#" extension="fsproj" guid="{f2a71f9b-5d33-465a-a702-920d77279786}" import="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets"  resourceHandler="MonoDevelop.FSharp.FSharpResourceIdBuilder"/>
+ 	</Condition>
+@@ -182,14 +187,7 @@
+     <ProjectTemplate id="FSharpConsoleProject" file="Templates/FSharpConsoleProject.xpt.xml"/>
+     <ProjectTemplate id="FSharpLibraryProject" file="Templates/FSharpLibraryProject.xpt.xml"/>
+     <!-- Only include the tutorial project if an F# 3.0 or 3.1 target is available as this includes F# 3.0 specific features -->
+-	<ComplexCondition>
+-		<Or>
+-			<Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
+-			<Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
+-		</Or>
+ 		<ProjectTemplate id="FSharpTutorialProject" file="Templates/FSharpTutorialProject.xpt.xml"/>
+-	</ComplexCondition>
+-
+     <ProjectTemplate id="FSharpGtkProject" file="Templates/FSharpGtkProject.xpt.xml"/>
+     <ProjectTemplate id="FSharpNUnitLibraryProject" file="Templates/FSharpNUnitLibraryProject.xpt.xml"/>
+   </Extension>
+@@ -267,13 +265,7 @@
+   <!-- F# interactive -->
+ 
+   <Extension path="/MonoDevelop/Ide/Pads">
+-    <ComplexCondition>
+-      <Or>
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
+-      </Or>
+       <Pad id="MonoDevelop.FSharp.FSharpInteractivePad" defaultPlacement="Bottom" _label="F# Interactive" icon="md-project" class="MonoDevelop.FSharp.FSharpInteractivePad" />
+-    </ComplexCondition>
+   </Extension>
+ 
+   <Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
+@@ -281,11 +273,6 @@
+   </Extension>
+ 
+   <Extension path="/MonoDevelop/Ide/Commands">
+-    <ComplexCondition>
+-      <Or>
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
+-      </Or>
+       <Category _name = "F# Integration" id="F# Integration">
+         <Command id="MonoDevelop.FSharp.FSharpCommands.ShowFSharpInteractive"
+             _label = "F# Interactive"
+@@ -330,32 +317,19 @@
+             macShortcut="Meta|Control|C"
+             shortcut="Ctrl|Alt|C" />
+       </Category>
+-    </ComplexCondition>
+   </Extension>
+ 
+   <Extension path = "/MonoDevelop/SourceEditor2/ContextMenu/Editor">
+-    <ComplexCondition>
+-      <Or>
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
+-      </Or>
+       <SeparatorItem id = "FSharpInteractiveStart" />
+       <CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendSelection" />
+       <CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendLine" />
+       <CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendReferences" />
+-    </ComplexCondition>
+   </Extension>
+ 
+   <Extension path = "/MonoDevelop/Ide/MainMenu/Edit">
+-    <ComplexCondition>
+-      <Or>
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
+-        <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
+-      </Or>
+       <CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendSelection" />
+       <CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendLine" />
+       <CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendReferences" />
+-    </ComplexCondition>
+   </Extension>
+ 
+   <!--- F# Android -->
diff --git a/pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.references.patch b/pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.references.patch
new file mode 100644
index 00000000000..e53482e0c00
--- /dev/null
+++ b/pkgs/development/dotnet-modules/patches/monodevelop-fsharpbinding.references.patch
@@ -0,0 +1,43 @@
+--- fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/MonoDevelop.FSharp.fsproj.orig.old	2015-06-03 18:48:55.345385084 +0100
++++ fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/MonoDevelop.FSharp.fsproj.orig	2015-06-03 19:00:11.453399028 +0100
+@@ -185,19 +185,19 @@
+       <Private>False</Private>
+       <HintPath>INSERT_FSPROJ_MDROOT\AddIns\NUnit\MonoDevelop.NUnit.dll</HintPath>
+     </Reference>
+-    <ProjectReference Include="..\..\FSharp.CompilerBinding\FSharp.CompilerBinding.fsproj">
+-      <Project>{88F6940F-D300-474C-B2A7-E2ECD5B04B57}</Project>
+-      <Name>FSharp.CompilerBinding</Name>
+-    </ProjectReference>
++    <Reference Include="FSharp.CompilerBinding">
++      <Private>True</Private>
++    </Reference>
+     <ProjectReference Include="Gui\MonoDevelop.FSharp.Gui.csproj">
+       <Project>{FD0D1033-9145-48E5-8ED8-E2365252878C}</Project>
+       <Name>MonoDevelop.FSharp.Gui</Name>
+     </ProjectReference>
+-    <Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
++    <Reference Include="FSharp.Core">
+       <Private>True</Private>
+     </Reference>
+     <Reference Include="FSharp.Compiler.Service">
+       <HintPath>packages\FSharp.Compiler.Service.0.0.85\lib\net45\FSharp.Compiler.Service.dll</HintPath>
++      <Private>True</Private>
+     </Reference>
+     <Reference Include="Mono.Cecil">
+       <HintPath>packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll</HintPath>
+@@ -213,12 +213,15 @@
+     </Reference>
+     <Reference Include="FantomasLib">
+       <HintPath>packages\Fantomas.1.6.0\lib\FantomasLib.dll</HintPath>
++      <Private>True</Private>
+     </Reference>
+     <Reference Include="FSharp.Compiler.CodeDom">
+       <HintPath>packages\FSharp.Compiler.CodeDom.0.9.1\lib\net40\FSharp.Compiler.CodeDom.dll</HintPath>
++      <Private>True</Private>
+     </Reference>
+     <Reference Include="ExtCore">
+       <HintPath>packages\ExtCore.0.8.45\lib\net40\ExtCore.dll</HintPath>
++      <Private>True</Private>
+     </Reference>
+   </ItemGroup>
+   <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
diff --git a/pkgs/development/dotnet-modules/patches/newtonsoft-json.references.patch b/pkgs/development/dotnet-modules/patches/newtonsoft-json.references.patch
new file mode 100644
index 00000000000..ed9b7adbef2
--- /dev/null
+++ b/pkgs/development/dotnet-modules/patches/newtonsoft-json.references.patch
@@ -0,0 +1,11 @@
+--- Newtonsoft.Json-6.0.8/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj.old	2015-01-11 06:46:39.000000000 +0000
++++ Newtonsoft.Json-6.0.8/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj	2015-05-25 21:29:40.546808622 +0100
+@@ -52,6 +52,8 @@
+     <Reference Include="System.Data.Linq" />
+     <Reference Include="System.Drawing" />
+     <Reference Include="System.Numerics" />
++    <Reference Include="System.Collections" />
++    <Reference Include="System.Runtime" />
+     <Reference Include="System.Runtime.Serialization" />
+     <Reference Include="System.Web" />
+     <Reference Include="System.Web.Extensions" />
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a3262dc7943..46b5b7fd146 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -285,6 +285,10 @@ let
     dotnetfx = dotnetfx40;
   };
 
+  dotnetbuildhelpers = import ../build-support/dotnetbuildhelpers {
+    inherit mono helperFunctions pkgconfig;
+  };
+
   scatterOutputHook = makeSetupHook {} ../build-support/setup-hooks/scatter_output.sh;
 
   vsenv = callPackage ../build-support/vsenv {
@@ -409,6 +413,9 @@ let
     meta.homepage = "http://repo.or.cz/${repo}.git/";
   };
 
+  fetchNuGet = import ../build-support/fetchnuget { inherit stdenv fetchurl buildDotnetPackage unzip; };
+  buildDotnetPackage = import ../build-support/build-dotnet-package { inherit stdenv lib makeWrapper mono pkgconfig dotnetbuildhelpers; };
+
   resolveMirrorURLs = {url}: fetchurl {
     showURLs = true;
     inherit url;
@@ -3872,6 +3879,8 @@ let
 
   fsharp = callPackage ../development/compilers/fsharp {};
 
+  dotnetPackages = recurseIntoAttrs (callPackage ./dotnet-packages.nix { inherit stdenv fetchNuGet; });
+
   go_1_0 = callPackage ../development/compilers/go { };
 
   go_1_1 =
diff --git a/pkgs/top-level/dotnet-packages.nix b/pkgs/top-level/dotnet-packages.nix
new file mode 100644
index 00000000000..852856d4c69
--- /dev/null
+++ b/pkgs/top-level/dotnet-packages.nix
@@ -0,0 +1,495 @@
+{ stdenv
+, pkgs
+, buildDotnetPackage
+, fetchurl
+, fetchFromGitHub
+, fetchNuGet
+, pkgconfig
+, mono
+, monodevelop
+, fsharp
+, unzip
+, overrides ? {}
+}:
+
+let self = dotnetPackages // overrides; dotnetPackages = with self; {
+
+  Autofac = fetchNuGet {
+    baseName = "Autofac";
+    version = "3.5.2";
+    sha256 = "194cs8ybn5xjqnzy643w5i62m0d5s34d3nshwxp2v4fcb94wa4ri";
+    outputFiles = [ "lib/portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1/*" ];
+  };
+
+  Fake = fetchNuGet {
+    baseName = "FAKE";
+    version = "3.33.0";
+    sha256 = "04gllx9d1w8zn9gq9p5k76b79ix07rilk3apdi72dmz6h3yylcdm";
+    outputFiles = [ "tools/*" ];
+    dllFiles = [ "Fake*.dll" ];
+  };
+
+  Fantomas = fetchNuGet {
+    baseName = "Fantomas";
+    version = "1.6.0";
+    sha256 = "1b9rd3i76b5xzv0j62dvfr1ksdwvb59vxw6jhzpi018axjn6757q";
+    outputFiles = [ "lib/*" ];
+    dllFiles = [ "Fantomas*.dll" ];
+  };
+
+  FSharpCompilerCodeDom = fetchNuGet {
+    baseName = "FSharp.Compiler.CodeDom";
+    version = "0.9.2";
+    sha256 = "0cy9gbvmfx2g74m7bgp6x9mr4avb6s560yjii7cyyxb7jlwabfcj";
+    outputFiles = [ "lib/net40/*" ];
+  };
+
+  FsCheck = fetchNuGet {
+    baseName = "FsCheck";
+    version = "1.0.4";
+    sha256 = "1q2wk4d4d1q94qzcccgmxb2lh0b8qkmpyz0p7lfphkw2gx6cy5ad";
+    outputFiles = [ "lib/net45/*" ];
+  };
+
+  FsCheckNunit = fetchNuGet {
+    baseName = "FsCheck.Nunit";
+    version = "1.0.4";
+    sha256 = "1s62jrsa5hxqy1ginl8r29rjdc8vbkwmz7mb0hglhwccdqfyr5xy";
+    outputFiles = [ "lib/net45/*" ];
+  };
+
+  FsUnit = fetchNuGet {
+    baseName = "FsUnit";
+    version = "1.3.0.1";
+    sha256 = "1k7w8pc81aplsfn7n46617khmzingd2v7hcgdhh7vgsssibwms64";
+    outputFiles = [ "Lib/Net40/*" ];
+  };
+
+  NUnit = fetchNuGet {
+    baseName = "NUnit";
+    version = "2.6.4";
+    sha256 = "1acwsm7p93b1hzfb83ia33145x0w6fvdsfjm9xflsisljxpdx35y";
+    outputFiles = [ "lib/*" ];
+  };
+
+  NUnitRunners = fetchNuGet {
+    baseName = "NUnit.Runners";
+    version = "2.6.4";
+    sha256 = "11nmi7vikn9idz8qcad9z7f73arsh5rw18fc1sri9ywz77mpm1s4";
+    outputFiles = [ "tools/*" ];
+    preInstall = "mv -v tools/lib/* tools && rmdir -v tools/lib";
+  };
+
+  SystemCollectionsImmutable = fetchNuGet {
+    baseName = "System.Collections.Immutable";
+    version = "1.1.36";
+    sha256 = "0760kzf5s771pnvnxsgas446kqdh1b71w6g3k75jpzldfmsd3vyq";
+    outputFiles = [ "lib/portable-net45+win8+wp8+wpa81/*" ];
+  };
+
+  ExtCore = buildDotnetPackage rec {
+    baseName = "ExtCore";
+    version = "0.8.46";
+
+    src = fetchFromGitHub {
+      owner = "jack-pappas";
+      repo = "ExtCore";
+      rev = "0269b6d3c479f45abd7aa983aaeca08d07473943";
+      sha256 = "1kxkiszpvqisffhd6wciha8j3dhkq06w9c540bmq8zixa4xaj83p";
+    };
+
+    buildInputs = [
+      fsharp
+      dotnetPackages.NUnit
+      dotnetPackages.FsCheck
+    ];
+
+    postConfigure = ''
+      # Fix case
+      sed -i -e s,nuget.targets,NuGet.targets, ExtCore.Tests/ExtCore.Tests.fsproj
+    '';
+
+    xBuildFlags = [ "/p:Configuration=Release (net45)" ];
+    outputFiles = [ "ExtCore/bin/net45/Release/*" ];
+
+    meta = {
+      description = "ExtCore is an extended core library for F#";
+      homepage = "https://github.com/jack-pappas/ExtCore";
+      license = stdenv.lib.licenses.asl20;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  FSharpAutoComplete = buildDotnetPackage rec {
+    baseName = "FSharp.AutoComplete";
+    version = "0.16.0";
+
+    src = fetchurl {
+      name = "${baseName}-${version}.tar.gz";
+      url = "https://github.com/fsharp/FSharp.AutoComplete/archive/${version}.tar.gz";
+      sha256 = "0mwp456zfw1sjy2mafz2shx0sjn4f858pfnsmawy50g8l2znw8qg";
+    };
+
+    buildInputs = [
+      fsharp
+      dotnetPackages.FSharpCompilerService
+      dotnetPackages.NewtonsoftJson
+      dotnetPackages.NDeskOptions
+    ];
+
+    outputFiles = [ "FSharp.AutoComplete/bin/Release/*" ];
+
+    meta = {
+      description = "This project provides a command-line interface to the FSharp.Compiler.Service project. It is intended to be used as a backend service for rich editing or 'intellisense' features for editors.";
+      homepage = "https://github.com/fsharp/FSharp.AutoComplete";
+      license = stdenv.lib.licenses.asl20;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  FSharpCompilerService = buildDotnetPackage rec {
+    baseName = "FSharp.Compiler.Service";
+    version = "0.0.89";
+
+    src = fetchFromGitHub {
+      owner = "fsharp";
+      repo = "FSharp.Compiler.Service";
+      rev = "55a8143a82bb31c3e8c1ad2af64eb64162fed0d7";
+      sha256 = "1f5f97382h8v9p0j7c2gksrps12d869m752n692b3g0k8h4zpial";
+    };
+
+    buildInputs = [
+      fsharp
+      dotnetPackages.NUnit
+    ];
+
+    outputFiles = [ "bin/v4.5/*" ];
+
+    meta = {
+      description = "The F# compiler services package is a component derived from the F# compiler source code that exposes additional functionality for implementing F# language bindings";
+      homepage = "http://fsharp.github.io/FSharp.Compiler.Service/";
+      license = stdenv.lib.licenses.asl20;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  FSharpData = buildDotnetPackage rec {
+    baseName = "FSharp.Data";
+    version = "2.2.2";
+
+    src = fetchurl {
+      name = "${baseName}-${version}.tar.gz";
+      url = "https://github.com/fsharp/FSharp.Data/archive/${version}.tar.gz";
+      sha256 = "1li33ydjxz18v8siw53vv1nmkp5w7sdlsjcrfp6dzcynpvwbjw3s";
+    };
+
+    buildInputs = [ fsharp ];
+
+    fileProvidedTypes = fetchurl {
+      name = "ProvidedTypes.fs";
+      url = https://raw.githubusercontent.com/fsprojects/FSharp.TypeProviders.StarterPack/877014bfa6244ac382642e113d7cd6c9bc27bc6d/src/ProvidedTypes.fs;
+      sha256 = "1lb056v1xld1rfx6a8p8i2jz8i6qa2r2823n5izsf1qg1qgf2980";
+    };
+
+    fileDebugProvidedTypes = fetchurl {
+      name = "DebugProvidedTypes.fs";
+      url = https://raw.githubusercontent.com/fsprojects/FSharp.TypeProviders.StarterPack/877014bfa6244ac382642e113d7cd6c9bc27bc6d/src/DebugProvidedTypes.fs;
+      sha256 = "1whyrf2jv6fs7kgysn2086v15ggjsd54g1xfs398mp46m0nxp91f";
+    };
+
+    preConfigure = ''
+       # Copy single-files-in-git-repos
+       mkdir -p "paket-files/fsprojects/FSharp.TypeProviders.StarterPack/src"
+       cp -v "${fileProvidedTypes}" "paket-files/fsprojects/FSharp.TypeProviders.StarterPack/src/ProvidedTypes.fs"
+       cp -v "${fileDebugProvidedTypes}" "paket-files/fsprojects/FSharp.TypeProviders.StarterPack/src/DebugProvidedTypes.fs"
+    '';
+
+    xBuildFiles = [ "src/FSharp.Data.fsproj" "src/FSharp.Data.DesignTime.fsproj" ];
+    outputFiles = [ "bin/*.dll" "bin/*.xml" ];
+
+    meta = {
+      description = "F# Data: Library for Data Access";
+      homepage = "http://fsharp.github.io/FSharp.Data/";
+      license = stdenv.lib.licenses.asl20;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  # FSharpxExtras = buildDotnetPackage rec {
+  #   baseName = "FSharpx.Extras";
+  #   version = "1.8.41";
+  #
+  #   src = fetchurl {
+  #     name = "${baseName}-${version}.tar.gz";
+  #     url = "https://github.com/fsprojects/FSharpx.Extras/archive/${version}.tar.gz";
+  #     sha256 = "102z5bvk3ffi1crgyp51488vamv41fsf61n8x8pdiznq155zydhl";
+  #   };
+  #
+  #   buildInputs = [
+  #     fsharp
+  #     dotnetPackages.NUnit
+  #     dotnetPackages.FsCheck
+  #     dotnetPackages.FsCheckNunit
+  #     dotnetPackages.FsUnit
+  #   ];
+  #
+  #   patches = [ ./disable_excel.patch ];
+  #
+  #   xBuildFiles = [ "FSharpx.WithTypeProviders.sln" ];
+  #   outputFiles = [ "build/*" ];
+  #
+  #   meta = {
+  #     description = "FSharpx.Extras is a collection of libraries and tools for use with F#.";
+  #     homepage = "http://fsprojects.github.io/FSharpx.Extras/";
+  #     license = stdenv.lib.licenses.asl20;
+  #     maintainers = with stdenv.lib.maintainers; [ obadz ];
+  #     platforms = with stdenv.lib.platforms; linux;
+  #   };
+  # };
+
+  MonoDevelopFSharpBinding = buildDotnetPackage rec {
+    baseName = "MonoDevelop.FSharpBinding";
+    version = "git-a09c8185eb";
+
+    src = fetchFromGitHub {
+      owner = "fsharp";
+      repo = "fsharpbinding";
+      rev = "a09c8185ebf23fe2f7d22b14b4af2e3268d4f011";
+      sha256 = "1zp5gig42s1h681kch0rw5ykbbj0mcsmdvpyz1319wy9s7n2ng91";
+    };
+
+    buildInputs = [
+      fsharp
+      monodevelop
+      pkgs.gtk-sharp
+      pkgs.gnome-sharp
+      dotnetPackages.ExtCore
+      dotnetPackages.FSharpCompilerService
+      dotnetPackages.FSharpCompilerCodeDom
+      dotnetPackages.FSharpAutoComplete
+      dotnetPackages.Fantomas
+    ];
+
+    patches = [
+      ../development/dotnet-modules/patches/monodevelop-fsharpbinding.references.patch
+      ../development/dotnet-modules/patches/monodevelop-fsharpbinding.addin-xml.patch
+    ];
+
+    preConfigure = ''
+      substituteInPlace monodevelop/configure.fsx --replace /usr/lib/monodevelop ${monodevelop}/lib/monodevelop
+      substituteInPlace monodevelop/configure.fsx --replace bin/MonoDevelop.exe ../../bin/monodevelop
+      (cd monodevelop; fsharpi ./configure.fsx)
+    '';
+
+    # This will not work as monodevelop probably looks in absolute nix store path rather than path
+    # relative to its executable. Need to ln -s /run/current-system/sw/lib/dotnet/MonoDevelop.FSharpBinding
+    # ~/.local/share/MonoDevelop-5.0/LocalInstall/Addins/ to install until we have a better way
+
+    # postInstall = ''
+    #   mkdir -p "$out/lib/monodevelop/AddIns"
+    #   ln -sv "$out/lib/dotnet/${baseName}" "$out/lib/monodevelop/AddIns"
+    # '';
+
+    xBuildFiles = [ "monodevelop/MonoDevelop.FSharpBinding/MonoDevelop.FSharp.mac-linux.fsproj" ];
+    outputFiles = [ "monodevelop/bin/mac-linux/Release/*" ];
+
+    meta = {
+      description = "F# addin for MonoDevelop 5.9";
+      homepage = "https://github.com/fsharp/fsharpbinding/tree/5.9";
+      license = stdenv.lib.licenses.asl20;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  NDeskOptions = stdenv.mkDerivation rec {
+    baseName = "NDesk.Options";
+    version = "0.2.1";
+    name = "${baseName}-${version}";
+
+    src = fetchurl {
+      name = "${baseName}-${version}.tar.gz";
+      url = "http://www.ndesk.org/archive/ndesk-options/ndesk-options-0.2.1.tar.gz";
+      sha256 = "1y25bfapafwmifakjzyb9c70qqpvza8g5j2jpf08j8wwzkrb6r28";
+    };
+
+    buildInputs = [
+      mono
+      pkgconfig
+    ];
+
+    preConfigure = ''
+      substituteInPlace configure --replace gmcs mcs
+    '';
+
+    postInstall = ''
+      # Otherwise pkg-config won't find it and the DLL will get duplicated
+      ln -sv $out/lib/pkgconfig/ndesk-options.pc $out/lib/pkgconfig/NDesk.Options.pc
+    '';
+
+    dontStrip = true;
+
+    meta = {
+      description = "NDesk.Options is a callback-based program option parser for C#.";
+      homepage = "http://www.ndesk.org/Options";
+      license = stdenv.lib.licenses.mit;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  NewtonsoftJson = buildDotnetPackage rec {
+    baseName = "Newtonsoft.Json";
+    version = "6.0.8";
+
+    src = fetchurl {
+      name = "${baseName}-${version}.tar.gz";
+      url = "https://github.com/JamesNK/Newtonsoft.Json/archive/${version}.tar.gz";
+      sha256 = "14znf5mycka578bxjnlnz6a3f9nfkc682hgmgg42gdzksnarvhlm";
+    };
+
+    buildInputs = [
+      fsharp
+      dotnetPackages.NUnit
+      dotnetPackages.SystemCollectionsImmutable
+      dotnetPackages.Autofac
+    ];
+
+    patches = [ ../development/dotnet-modules/patches/newtonsoft-json.references.patch ];
+
+    postConfigure = ''
+       # Just to make sure there's no attempt to call these executables
+       rm -rvf Tools
+    '';
+
+    xBuildFiles = [ "Src/Newtonsoft.Json.sln" ];
+    outputFiles = [ "Src/Newtonsoft.Json/bin/Release/Net45/*" ];
+
+    meta = {
+      description = "Popular high-performance JSON framework for .NET";
+      homepage = "http://www.newtonsoft.com/json";
+      license = stdenv.lib.licenses.mit;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  Nuget = buildDotnetPackage {
+    baseName = "Nuget";
+    version = "2.8.5";
+
+    src = fetchFromGitHub {
+      owner = "mono";
+      repo = "nuget-binary";
+      rev = "da1f2102f8172df6f7a1370a4998e3f88b91c047";
+      sha256 = "1hbnckc4gvqkknf8gh1k7iwqb4vdzifdjd19i60fnczly5v8m1c3";
+    };
+
+    buildInputs = [ unzip ];
+
+    phases = [ "unpackPhase" "installPhase" ];
+
+    outputFiles = [ "*" ];
+    dllFiles = [ "NuGet*.dll" ];
+    exeFiles = [ "NuGet.exe" ];
+  };
+
+  Paket = buildDotnetPackage rec {
+    baseName = "Paket";
+    version = "1.6.2";
+
+    src = fetchurl {
+      name = "${baseName}-${version}.tar.gz";
+      url = "https://github.com/fsprojects/Paket/archive/${version}.tar.gz";
+      sha256 = "1ryslxdgc3r7kcn1gq4bqcyrqdi8z6364aj3lr7yjz71wi22fca8";
+    };
+
+    buildInputs = [
+      fsharp
+      dotnetPackages.NewtonsoftJson
+      dotnetPackages.UnionArgParser
+      dotnetPackages.NUnit
+    ];
+
+    fileFsUnit = fetchurl {
+      name = "FsUnit.fs";
+      url = https://raw.githubusercontent.com/forki/FsUnit/81d27fd09575a32c4ed52eadb2eeac5f365b8348/FsUnit.fs;
+      sha256 = "1zxigqgb2s2v755622jbbzibvf91990x2dijhbdgg646vsybkpdp";
+    };
+
+    # fileOctokit = fetchurl {
+    #   name = "Octokit.fsx";
+    #   url = https://raw.githubusercontent.com/fsharp/FAKE/8e65e2fc1406f326b44f3f87ec9ca9b3127a6e78/modules/Octokit/Octokit.fsx;
+    #   sha256 = "16qxwmgyg3fn3z9a8hppv1m579828x7lvfj8qflcgs2g6ciagsir";
+    # };
+
+    fileGlobbing = fetchurl {
+      name = "Globbing.fs";
+      url = https://raw.githubusercontent.com/fsharp/FAKE/8e65e2fc1406f326b44f3f87ec9ca9b3127a6e78/src/app/FakeLib/Globbing/Globbing.fs;
+      sha256 = "1v7d7666a61j6f8ksh0q40hfsc5b03448viq17xa91xgb7skhyx7";
+    };
+
+    fileErrorHandling = fetchurl {
+      name = "ErrorHandling.fs";
+      url = https://raw.githubusercontent.com/fsprojects/Chessie/3017092260b4a59a3b4b25bf8fca6be6eb7487eb/src/Chessie/ErrorHandling.fs;
+      sha256 = "0ka9ilfbl4izxc1wqd5vlfjnp7n2xcckfhp13gzhqbdx7464van9";
+    };
+
+    postConfigure = ''
+       # Copy said single-files-in-git-repos
+       mkdir -p "paket-files/forki/FsUnit"
+       cp -v "${fileFsUnit}" "paket-files/forki/FsUnit/FsUnit.fs"
+
+       mkdir -p "paket-files/fsharp/FAKE/src/app/FakeLib/Globbing"
+       cp -v "${fileGlobbing}" "paket-files/fsharp/FAKE/src/app/FakeLib/Globbing/Globbing.fs"
+
+       mkdir -p "paket-files/fsprojects/Chessie/src/Chessie"
+       cp -v "${fileErrorHandling}" "paket-files/fsprojects/Chessie/src/Chessie/ErrorHandling.fs"
+    '';
+
+    xBuildFiles = [ ];
+
+    outputFiles = [ "bin/*" ];
+    exeFiles = [ "paket.exe" ];
+
+    meta = {
+      description = "A dependency manager for .NET and Mono projects";
+      homepage = "http://fsprojects.github.io/Paket/";
+      license = stdenv.lib.licenses.mit;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+
+  UnionArgParser = buildDotnetPackage rec {
+    baseName = "UnionArgParser";
+    version = "0.8.7";
+
+    src = fetchFromGitHub {
+      owner = "nessos";
+      repo = "UnionArgParser";
+      rev = "acaeb946e53cbb0bd9768977c656b3242146070a";
+      sha256 = "1yrs7ycf2hg7h8z6vm9lr7i3gr9s30k74fr2maigdydnnls93als";
+    };
+
+    buildInputs = [
+      fsharp
+      dotnetPackages.NUnit
+      dotnetPackages.FsUnit
+    ];
+
+    outputFiles = [ "bin/net40/*" ];
+
+    meta = {
+      description = "A declarative CLI argument/XML configuration parser for F# applications.";
+      homepage = "http://nessos.github.io/UnionArgParser/";
+      license = stdenv.lib.licenses.mit;
+      maintainers = with stdenv.lib.maintainers; [ obadz ];
+      platforms = with stdenv.lib.platforms; linux;
+    };
+  };
+}; in self