2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv
|
2020-12-30 14:21:44 +00:00
|
|
|
, fetchFromGitHub
|
2019-04-11 22:45:02 +01:00
|
|
|
, fetchurl
|
2020-12-30 14:21:44 +00:00
|
|
|
, mono6
|
2021-03-19 13:31:03 +00:00
|
|
|
, msbuild
|
2021-09-26 22:06:38 +01:00
|
|
|
, dotnetCorePackages
|
2019-04-11 22:45:02 +01:00
|
|
|
, makeWrapper
|
2020-12-30 14:21:44 +00:00
|
|
|
, unzip
|
|
|
|
, writeText
|
2019-04-11 22:45:02 +01:00
|
|
|
}:
|
|
|
|
|
2020-12-30 14:21:44 +00:00
|
|
|
let
|
|
|
|
|
2021-09-26 22:06:38 +01:00
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_5_0;
|
|
|
|
|
2020-12-30 14:21:44 +00:00
|
|
|
deps = map (package: stdenv.mkDerivation (with package; {
|
|
|
|
pname = name;
|
|
|
|
inherit version src;
|
|
|
|
|
|
|
|
buildInputs = [ unzip ];
|
|
|
|
unpackPhase = ''
|
|
|
|
unzip $src
|
|
|
|
chmod -R u+r .
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
package=$out/lib/dotnet/${name}/${version}
|
|
|
|
mkdir -p $package
|
|
|
|
cp -r . $package
|
|
|
|
echo "{}" > $package/.nupkg.metadata
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontFixup = true;
|
|
|
|
}))
|
|
|
|
(import ./deps.nix { inherit fetchurl; });
|
|
|
|
|
|
|
|
nuget-config = writeText "NuGet.Config" ''
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<configuration>
|
|
|
|
<packageSources>
|
|
|
|
<clear />
|
|
|
|
</packageSources>
|
|
|
|
<fallbackPackageFolders>
|
|
|
|
${lib.concatStringsSep "\n" (map (package: "<add key=\"${package}\" value=\"${package}/lib/dotnet\"/>") deps)}
|
|
|
|
</fallbackPackageFolders>
|
|
|
|
</configuration>
|
|
|
|
'';
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-04-11 22:45:02 +01:00
|
|
|
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "omnisharp-roslyn";
|
2021-08-31 20:16:24 +01:00
|
|
|
version = "1.37.15";
|
2020-05-24 14:09:15 +01:00
|
|
|
|
2020-12-30 14:21:44 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "OmniSharp";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-08-31 20:16:24 +01:00
|
|
|
sha256 = "070wqs667si3f78fy6w4rrfm8qncnabg0yckjhll0yv1pzbj9q42";
|
2019-04-11 22:45:02 +01:00
|
|
|
};
|
|
|
|
|
2020-12-30 14:21:44 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper msbuild ];
|
2019-04-11 22:45:02 +01:00
|
|
|
|
2020-12-30 14:21:44 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2021-07-30 20:17:47 +01:00
|
|
|
HOME=$(pwd)/fake-home msbuild -r \
|
|
|
|
-p:Configuration=Release \
|
|
|
|
-p:RestoreConfigFile=${nuget-config} \
|
|
|
|
src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj
|
2020-12-30 14:21:44 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
2019-04-11 22:45:02 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2020-12-30 14:21:44 +00:00
|
|
|
cp -r bin/Release/OmniSharp.Stdio.Driver/net472 $out/src
|
|
|
|
cp bin/Release/OmniSharp.Host/net472/SQLitePCLRaw* $out/src
|
|
|
|
mkdir $out/src/.msbuild
|
|
|
|
ln -s ${msbuild}/lib/mono/xbuild/* $out/src/.msbuild/
|
|
|
|
rm $out/src/.msbuild/Current
|
|
|
|
mkdir $out/src/.msbuild/Current
|
|
|
|
ln -s ${msbuild}/lib/mono/xbuild/Current/* $out/src/.msbuild/Current/
|
|
|
|
ln -s ${msbuild}/lib/mono/msbuild/Current/bin $out/src/.msbuild/Current/Bin
|
2021-03-19 13:31:03 +00:00
|
|
|
|
2020-12-30 14:21:44 +00:00
|
|
|
makeWrapper ${mono6}/bin/mono $out/bin/omnisharp \
|
2021-07-30 19:31:53 +01:00
|
|
|
--suffix PATH : ${dotnet-sdk}/bin \
|
2020-12-30 14:21:44 +00:00
|
|
|
--add-flags "$out/src/OmniSharp.exe"
|
2019-04-11 22:45:02 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2019-04-11 22:45:02 +01:00
|
|
|
description = "OmniSharp based on roslyn workspaces";
|
2020-05-24 14:09:15 +01:00
|
|
|
homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
|
2019-04-11 22:45:02 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.mit;
|
2020-12-30 14:21:44 +00:00
|
|
|
maintainers = with maintainers; [ tesq0 ericdallo corngood ];
|
2019-04-11 22:45:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|