Skip to content

Commit

Permalink
discordchatexporter-desktop: init at 2.44 (NixOS#353864)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Dec 19, 2024
2 parents 338ad16 + e9f84d2 commit f502f8e
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 0 deletions.
59 changes: 59 additions & 0 deletions pkgs/by-name/di/discordchatexporter-desktop/deps.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions pkgs/by-name/di/discordchatexporter-desktop/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
lib,
buildDotnetModule,
dotnetCorePackages,
fetchFromGitHub,
testers,
discordchatexporter-desktop,
}:

buildDotnetModule rec {
pname = "discordchatexporter-desktop";
version = "2.44";

src = fetchFromGitHub {
owner = "tyrrrz";
repo = "discordchatexporter";
rev = version;
hash = "sha256-eLwSodbEux8pYXNZZg8c2rCYowTEkvPzYbxANYe0O7w=";
};

env.XDG_CONFIG_HOME = "$HOME/.config";

projectFile = "DiscordChatExporter.Gui/DiscordChatExporter.Gui.csproj";
nugetDeps = ./deps.nix;
dotnet-sdk = dotnetCorePackages.sdk_9_0;
dotnet-runtime = dotnetCorePackages.runtime_9_0;

patches = [ ./settings-path.patch ];

postFixup = ''
ln -s $out/bin/DiscordChatExporter $out/bin/discordchatexporter
'';

passthru = {
updateScript = ./updater.sh;
};

meta = with lib; {
description = "Tool to export Discord chat logs to a file (GUI version)";
homepage = "https://github.com/Tyrrrz/DiscordChatExporter";
license = licenses.gpl3Plus;
changelog = "https://github.com/Tyrrrz/DiscordChatExporter/blob/${version}/Changelog.md";
maintainers = with maintainers; [ kekschen ];
platforms = [ "x86_64-linux" ];
mainProgram = "discordchatexporter";
};
}
19 changes: 19 additions & 0 deletions pkgs/by-name/di/discordchatexporter-desktop/settings-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/DiscordChatExporter.Gui/Services/SettingsService.cs b/DiscordChatExporter.Gui/Services/SettingsService.cs
index 4f69969..80a8d4b 100644
--- a/DiscordChatExporter.Gui/Services/SettingsService.cs
+++ b/DiscordChatExporter.Gui/Services/SettingsService.cs
@@ -14,7 +14,13 @@ namespace DiscordChatExporter.Gui.Services;
[INotifyPropertyChanged]
public partial class SettingsService()
: SettingsBase(
- Path.Combine(AppContext.BaseDirectory, "Settings.dat"),
+ Path.Combine(
+ System.IO.Path.Combine(
+ Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
+ "discordchatexporter"
+ ),
+ "Settings.dat"
+ ),
SerializerContext.Default
)
{
15 changes: 15 additions & 0 deletions pkgs/by-name/di/discordchatexporter-desktop/updater.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"

new_version="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/tyrrrz/DiscordChatExporter/releases?per_page=1" | jq -r '.[0].name')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./package.nix)"
if [[ "$new_version" == "$old_version" ]]; then
echo "Up to date"
exit 0
fi

cd ../../../..
update-source-version discordchatexporter-desktop "$new_version"
$(nix-build -A discordchatexporter-desktop.fetch-deps --no-out-link)

0 comments on commit f502f8e

Please sign in to comment.