depot/third_party/nixpkgs/pkgs/tools/misc/depotdownloader/default.nix
Default email 556d6f0562 Project import generated by Copybara.
GitOrigin-RevId: e4ef597edfd8a0ba5f12362932fc9b1dd01a0aef
2021-10-11 18:52:03 +02:00

49 lines
1.4 KiB
Nix

{ stdenv, lib, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper
, dotnet-sdk_5, dotnetPackages
}:
let
fetchNuGet = {name, version, sha256}: fetchurl {
name = "nuget-${name}-${version}.nupkg";
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
inherit sha256;
};
deps = import ./deps.nix fetchNuGet;
in
stdenv.mkDerivation rec {
pname = "depotdownloader";
version = "2.4.5";
src = fetchFromGitHub {
owner = "SteamRE";
repo = "DepotDownloader";
rev = "DepotDownloader_${version}";
sha256 = "0i5qgjnliji1g408ks1034r69vqdmfnzanb0qm7jmyzwww7vwpnh";
};
nativeBuildInputs = [ dotnet-sdk_5 dotnetPackages.Nuget makeWrapper ];
buildPhase = ''
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
export HOME=$TMP/home
nuget sources Add -Name tmpsrc -Source $TMP/nuget
nuget init ${linkFarmFromDrvs "deps" deps} $TMP/nuget
dotnet restore --source $TMP/nuget DepotDownloader/DepotDownloader.csproj
dotnet publish --no-restore -c Release --output $out
'';
installPhase = ''
makeWrapper ${dotnet-sdk_5}/bin/dotnet $out/bin/$pname \
--add-flags $out/DepotDownloader.dll
'';
meta = with lib; {
description = "Steam depot downloader utilizing the SteamKit2 library.";
license = licenses.gpl2Only;
maintainers = [ maintainers.babbaj ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
};
}