-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
/
Copy pathdefault.nix
71 lines (64 loc) · 1.68 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ symlinkJoin
, fetchurl
, stdenvNoCC
, lib
, unzip
, patchNupkgs
, nugetPackageHook
}:
lib.makeOverridable(
{ name
, nugetDeps ? import sourceFile
, sourceFile ? null
, installable ? false
}:
(symlinkJoin {
name = "${name}-nuget-deps";
paths = nugetDeps {
fetchNuGet =
{ pname
, version
, sha256 ? ""
, hash ? ""
, url ? "https://www.nuget.org/api/v2/package/${pname}/${version}" }:
stdenvNoCC.mkDerivation rec {
inherit pname version;
src = fetchurl {
name = "${pname}.${version}.nupkg";
# There is no need to verify whether both sha256 and hash are
# valid here, because nuget-to-nix does not generate a deps.nix
# containing both.
inherit url sha256 hash version;
};
nativeBuildInputs = [
unzip
patchNupkgs
nugetPackageHook
];
unpackPhase = ''
unzip -nq $src
chmod -R +rw .
'';
prePatch = ''
shopt -s nullglob
local dir
for dir in tools runtimes/*/native; do
[[ ! -d "$dir" ]] || chmod -R +x "$dir"
done
rm -rf .signature.p7s
'';
installPhase = ''
dir=$out/share/nuget/packages/${lib.toLower pname}/${lib.toLower version}
mkdir -p $dir
cp -r . $dir
echo {} > "$dir"/.nupkg.metadata
'';
preFixup = ''
patch-nupkgs $out/share/nuget/packages
'';
createInstallableNugetSource = installable;
};
};
}) // {
inherit sourceFile;
})