-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
53 lines (45 loc) · 1.18 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
pkgs ? import <nixpkgs> {},
delveBinary ? "",
doCheck ? true
}:
with pkgs;
let
deps = import ./deps.nix {inherit fetchurl;};
in
stdenv.mkDerivation rec {
name = "delve-csharp-client-sdk-${version}";
version = "1.2.0";
buildInputs = [
delveBinary
dotnet-sdk_3
dotnetPackages.Nuget
];
src = ./.;
buildPhase = ''
mkdir home
export HOME=$PWD/home
# disable default-source so nuget does not try to download from online-repo
nuget sources Disable -Name "nuget.org"
# add all dependencies to source called 'deps'
for package in ${toString deps}; do
nuget add $package -Source $HOME/deps
done
dotnet restore --source $HOME/deps DelveClientSDK.sln
dotnet build --no-restore -c Release DelveClientSDK.sln
'';
installPhase = ''
dotnet pack DelveClientSDK/DelveClientSDK.csproj
mkdir -p $out/{bin,lib}
cp -v DelveClientSDK/bin/Debug/DelveClientSDK.${version}.nupkg $out/lib
'';
checkPhase = ''
delve server &
PID=$!
sleep 15s
dotnet test --no-restore --filter LocalIntegrationTests || (kill -9 $PID && exit 1)
echo "Shutting down delve server. Pid: $PID"
kill -9 $PID
'';
inherit doCheck;
}