mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
dotnetCorePackages.fetchNupkg: split from mkNugetDeps
This commit is contained in:
parent
d4776214f7
commit
7ea78aaf5a
67
pkgs/build-support/dotnet/fetch-nupkg/default.nix
Normal file
67
pkgs/build-support/dotnet/fetch-nupkg/default.nix
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
symlinkJoin,
|
||||||
|
fetchurl,
|
||||||
|
stdenvNoCC,
|
||||||
|
lib,
|
||||||
|
unzip,
|
||||||
|
patchNupkgs,
|
||||||
|
nugetPackageHook,
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
pname,
|
||||||
|
version,
|
||||||
|
sha256 ? "",
|
||||||
|
hash ? "",
|
||||||
|
url ? "https://www.nuget.org/api/v2/package/${pname}/${version}",
|
||||||
|
installable ? false,
|
||||||
|
}:
|
||||||
|
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 -nqd source $src
|
||||||
|
chmod -R +rw source
|
||||||
|
cd source
|
||||||
|
'';
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
, unzip
|
, unzip
|
||||||
, patchNupkgs
|
, patchNupkgs
|
||||||
, nugetPackageHook
|
, nugetPackageHook
|
||||||
|
, fetchNupkg
|
||||||
}:
|
}:
|
||||||
lib.makeOverridable(
|
lib.makeOverridable(
|
||||||
{ name
|
{ name
|
||||||
@ -15,57 +16,7 @@ lib.makeOverridable(
|
|||||||
(symlinkJoin {
|
(symlinkJoin {
|
||||||
name = "${name}-nuget-deps";
|
name = "${name}-nuget-deps";
|
||||||
paths = nugetDeps {
|
paths = nugetDeps {
|
||||||
fetchNuGet =
|
fetchNuGet = args: fetchNupkg (args // { inherit installable; });
|
||||||
{ 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 -nqd source $src
|
|
||||||
chmod -R +rw source
|
|
||||||
cd source
|
|
||||||
'';
|
|
||||||
|
|
||||||
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;
|
inherit sourceFile;
|
||||||
|
@ -53,6 +53,7 @@ makeScopeWithSplicing' {
|
|||||||
|
|
||||||
mkNugetSource = callPackage ../../../build-support/dotnet/make-nuget-source { };
|
mkNugetSource = callPackage ../../../build-support/dotnet/make-nuget-source { };
|
||||||
mkNugetDeps = callPackage ../../../build-support/dotnet/make-nuget-deps { };
|
mkNugetDeps = callPackage ../../../build-support/dotnet/make-nuget-deps { };
|
||||||
|
fetchNupkg = callPackage ../../../build-support/dotnet/fetch-nupkg { };
|
||||||
|
|
||||||
dotnet_8 = recurseIntoAttrs (callPackage ./8 { bootstrapSdk = dotnet_8_0.sdk_8_0_1xx; });
|
dotnet_8 = recurseIntoAttrs (callPackage ./8 { bootstrapSdk = dotnet_8_0.sdk_8_0_1xx; });
|
||||||
dotnet_9 = recurseIntoAttrs (callPackage ./9 {});
|
dotnet_9 = recurseIntoAttrs (callPackage ./9 {});
|
||||||
|
Loading…
Reference in New Issue
Block a user