azure-artifacts-credprovider: init at 1.0.9 (#275285)
This commit is contained in:
+1023
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
{
|
||||
lib,
|
||||
buildDotnetModule,
|
||||
dotnetCorePackages,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
buildDotnetModule rec {
|
||||
dotnet-sdk = dotnetCorePackages.sdk_8_0;
|
||||
dotnet-runtime = dotnetCorePackages.runtime_8_0;
|
||||
version = "1.3.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "microsoft";
|
||||
repo = "artifacts-credprovider";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-JbcoDs4c/+uKIgVWZkuo4jqd1hlqe+H949jNfkDwZls=";
|
||||
};
|
||||
pname = "azure-artifacts-credprovider";
|
||||
projectFile = "CredentialProvider.Microsoft/CredentialProvider.Microsoft.csproj";
|
||||
testProjectFile = "CredentialProvider.Microsoft.Tests/CredentialProvider.Microsoft.Tests.csproj";
|
||||
nugetDeps = ./deps.nix;
|
||||
passthru.updateScript = ./update.sh;
|
||||
patchPhase = ''
|
||||
sed -i 's|<TargetFrameworks>.*</TargetFrameworks>|<TargetFramework>net8.0</TargetFramework>|' Build.props
|
||||
'';
|
||||
meta = {
|
||||
homepage = "https://github.com/microsoft/artifacts-credprovider";
|
||||
description = "Azure Artifacts Credential Provider";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ anpin ];
|
||||
mainProgram = "CredentialProvider.Microsoft";
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused gawk nix-prefetch jq dotnet-sdk_8 nuget-to-nix
|
||||
|
||||
set -euo pipefail
|
||||
URL="https://github.com/microsoft/artifacts-credprovider"
|
||||
|
||||
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||
NIX_DRV="$ROOT/package.nix"
|
||||
if [ ! -f "$NIX_DRV" ]; then
|
||||
echo "ERROR: cannot find package.nix in $ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMP="$(mktemp -d)"
|
||||
clean_up() {
|
||||
rm -rf "$TMP"
|
||||
}
|
||||
trap clean_up EXIT SIGINT SIGTERM
|
||||
PACKAGES="$TMP/packages"
|
||||
SRC_RW="$TMP/src"
|
||||
|
||||
mkdir -p $SRC_RW
|
||||
mkdir -p $PACKAGES
|
||||
|
||||
|
||||
VER=$(curl -s "https://api.github.com/repos/microsoft/artifacts-credprovider/releases/latest" | jq -r .tag_name | grep -oP '\d+\.\d+\.\d+' )
|
||||
HASH=$(nix-hash --to-sri --type sha256 "$(nix-prefetch-git --url $URL --rev "v$VER" --quiet | jq -r .sha256)")
|
||||
|
||||
sed -i "s/version = \".*\"/version = \"$VER\"/" "$NIX_DRV"
|
||||
sed -i "s#sha256 = \"sha256-.\{44\}\"#sha256 = \"$HASH\"#" "$NIX_DRV"
|
||||
|
||||
nix-prefetch-git --url $URL --rev "v$VER" --out $SRC_RW --builder --quiet
|
||||
rm $SRC_RW/nuget.config
|
||||
dotnet restore "$SRC_RW/MicrosoftCredentialProvider.sln" --packages $PACKAGES -r:linux-x64
|
||||
nuget-to-nix $PACKAGES > deps.nix
|
||||
Reference in New Issue
Block a user