about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/backup/discordchatexporter-cli/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/backup/discordchatexporter-cli/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/backup/discordchatexporter-cli/default.nix76
1 files changed, 12 insertions, 64 deletions
diff --git a/nixpkgs/pkgs/tools/backup/discordchatexporter-cli/default.nix b/nixpkgs/pkgs/tools/backup/discordchatexporter-cli/default.nix
index fe7b041b1533..38dfd55783de 100644
--- a/nixpkgs/pkgs/tools/backup/discordchatexporter-cli/default.nix
+++ b/nixpkgs/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.runtime_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";