diff options
author | IvarWithoutBones <ivar.scholten@protonmail.com> | 2021-09-23 19:44:06 +0200 |
---|---|---|
committer | IvarWithoutBones <ivar.scholten@protonmail.com> | 2021-10-06 22:14:24 +0200 |
commit | e93d52e69eb438ca45ab8dc3b2bead4d18ade8fd (patch) | |
tree | 69ceaa158b2412abf0e94e2a6bf552cf8651b734 /pkgs/tools/backup/discordchatexporter-cli | |
parent | 84cb383424277e1080742a94aedae1c86fe1b087 (diff) |
discordchatexporter-cli: use buildDotnetModule
Diffstat (limited to 'pkgs/tools/backup/discordchatexporter-cli')
-rw-r--r-- | pkgs/tools/backup/discordchatexporter-cli/default.nix | 76 |
1 files changed, 12 insertions, 64 deletions
diff --git a/pkgs/tools/backup/discordchatexporter-cli/default.nix b/pkgs/tools/backup/discordchatexporter-cli/default.nix index fe7b041b15333..60437403e5a29 100644 --- a/pkgs/tools/backup/discordchatexporter-cli/default.nix +++ b/pkgs/tools/backup/discordchatexporter-cli/default.nix @@ -1,11 +1,12 @@ -{ lib, stdenv, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper, autoPatchelfHook -, dotnet-sdk_5, dotnetPackages, dotnetCorePackages, cacert +{ lib +, stdenv +, buildDotnetModule +, fetchFromGitHub +, autoPatchelfHook +, dotnetCorePackages }: -let - projectFile = "DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj"; -in -stdenv.mkDerivation rec { +buildDotnetModule rec { pname = "discordchatexporter-cli"; version = "2.30.1"; @@ -16,65 +17,12 @@ stdenv.mkDerivation rec { sha256 = "JSYIhd+DNVOKseHtWNNChECR5hKr+ntu1Yyqtnlg8rM="; }; - nativeBuildInputs = [ dotnet-sdk_5 dotnetPackages.Nuget cacert makeWrapper autoPatchelfHook ]; - buildInputs = [ stdenv.cc.cc.lib ]; - - nugetDeps = linkFarmFromDrvs "${pname}-nuget-deps" (import ./deps.nix { - fetchNuGet = { name, version, sha256 }: fetchurl { - name = "nuget-${name}-${version}.nupkg"; - url = "https://www.nuget.org/api/v2/package/${name}/${version}"; - inherit sha256; - }; - }); - - configurePhase = '' - runHook preConfigure - - export HOME=$(mktemp -d) - export DOTNET_CLI_TELEMETRY_OPTOUT=1 - export DOTNET_NOLOGO=1 - - nuget sources Add -Name nixos -Source "$PWD/nixos" - nuget init "$nugetDeps" "$PWD/nixos" - - # FIXME: https://github.com/NuGet/Home/issues/4413 - mkdir -p $HOME/.nuget/NuGet - cp $HOME/.config/NuGet/NuGet.Config $HOME/.nuget/NuGet - - dotnet restore --source "$PWD/nixos" ${projectFile} - - runHook postConfigure - ''; - - buildPhase = '' - runHook preBuild - - dotnet build ${projectFile} \ - --no-restore \ - --configuration Release \ - -p:Version=${version} - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - dotnet publish ${projectFile} \ - --no-build \ - --configuration Release \ - --no-self-contained \ - --output $out/lib/${pname} - shopt -s extglob - - makeWrapper $out/lib/${pname}/DiscordChatExporter.Cli $out/bin/discordchatexporter-cli \ - --set DOTNET_ROOT "${dotnetCorePackages.sdk_3_1}" - - runHook postInstall - ''; + projectFile = "DiscordChatExporter.Cli/DiscordChatExporter.Cli.csproj"; + dotnet-runtime = dotnetCorePackages.netcore_3_1; + nugetDeps = ./deps.nix; - # Strip breaks the executable. - dontStrip = true; + nativeBuildInputs = [ autoPatchelfHook ]; + buildInputs = [ stdenv.cc.cc.lib ]; meta = with lib; { description = "A tool to export Discord chat logs to a file"; |