nixpkgs/pkgs/development/tools/omnisharp-roslyn/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

107 lines
2.4 KiB
Nix
Raw Normal View History

{ lib, stdenv
, fetchFromGitHub
2019-04-11 21:45:02 +00:00
, fetchurl
, dotnetCorePackages
2019-04-11 21:45:02 +00:00
, makeWrapper
, unzip
, writeText
2019-04-11 21:45:02 +00:00
}:
let
2022-02-08 17:14:31 +00:00
dotnet-sdk = dotnetCorePackages.sdk_6_0;
deps = map (package: stdenv.mkDerivation (with package; {
2022-01-23 12:39:52 +00:00
inherit pname 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
2022-01-23 12:39:52 +00:00
package=$out/lib/dotnet/${pname}/${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 21:45:02 +00:00
pname = "omnisharp-roslyn";
2022-02-08 17:14:31 +00:00
version = "1.38.0";
2020-05-24 13:09:15 +00:00
src = fetchFromGitHub {
owner = "OmniSharp";
repo = pname;
rev = "v${version}";
2022-02-08 17:14:31 +00:00
sha256 = "00V+7Z1IoCSuSM0RClM81IslzCzC/FNYxHIKtnI9QDg=";
2019-04-11 21:45:02 +00:00
};
2022-02-08 17:14:31 +00:00
nativeBuildInputs = [ makeWrapper dotnet-sdk ];
2019-04-11 21:45:02 +00:00
buildPhase = ''
runHook preBuild
2022-02-08 17:14:31 +00:00
HOME=$(pwd)/fake-home dotnet msbuild -r \
-p:Configuration=Release \
-p:RestoreConfigFile=${nuget-config} \
src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj
runHook postBuild
2019-04-11 21:45:02 +00:00
'';
installPhase = ''
mkdir -p $out/bin
2022-02-08 17:14:31 +00:00
cp -r bin/Release/OmniSharp.Stdio.Driver/net6.0 $out/src
makeWrapper $out/src/OmniSharp $out/bin/omnisharp \
--prefix DOTNET_ROOT : ${dotnet-sdk} \
--suffix PATH : ${dotnet-sdk}/bin
2019-04-11 21:45:02 +00:00
'';
meta = with lib; {
2019-04-11 21:45:02 +00:00
description = "OmniSharp based on roslyn workspaces";
2020-05-24 13:09:15 +00:00
homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
2022-02-27 15:56:10 +00:00
platforms = platforms.unix;
2019-04-11 21:45:02 +00:00
license = licenses.mit;
maintainers = with maintainers; [ tesq0 ericdallo corngood ];
2019-04-11 21:45:02 +00:00
};
}