mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
discordchatexporter-desktop: fix build for darwin + simpler (#553777)
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildDotnetModule,
|
||||
dotnetCorePackages,
|
||||
fetchFromGitHub,
|
||||
copyDesktopItems,
|
||||
desktopToDarwinBundle,
|
||||
makeDesktopItem,
|
||||
makeBinaryWrapper,
|
||||
gitUpdater,
|
||||
_experimental-update-script-combinators,
|
||||
libGL,
|
||||
libx11,
|
||||
libxcursor,
|
||||
libxext,
|
||||
libxi,
|
||||
libxrandr,
|
||||
libice,
|
||||
libsm,
|
||||
}:
|
||||
|
||||
buildDotnetModule (finalAttrs: {
|
||||
@@ -23,13 +38,71 @@ buildDotnetModule (finalAttrs: {
|
||||
dotnet-sdk = dotnetCorePackages.sdk_10_0;
|
||||
dotnet-runtime = dotnetCorePackages.runtime_10_0;
|
||||
|
||||
patches = [ ./settings-path.patch ];
|
||||
dotnetBuildFlags = [
|
||||
"-p:CSharpier_Bypass=true"
|
||||
"-p:FirstTargetFrameworks=workaround-for-csharpier-pr-1696"
|
||||
];
|
||||
|
||||
postFixup = ''
|
||||
ln -s $out/bin/DiscordChatExporter $out/bin/discordchatexporter
|
||||
executables = [ "DiscordChatExporter" ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace DiscordChatExporter.Gui/StartOptions.cs \
|
||||
--replace-fail 'AppContext.BaseDirectory' 'Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "discordchatexporter")'
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./updater.sh;
|
||||
nativeBuildInputs = [
|
||||
copyDesktopItems
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
desktopToDarwinBundle
|
||||
makeBinaryWrapper
|
||||
];
|
||||
|
||||
runtimeDeps = lib.optionals stdenv.hostPlatform.isLinux [
|
||||
libGL
|
||||
libx11
|
||||
libxcursor
|
||||
libxext
|
||||
libxi
|
||||
libxrandr
|
||||
libice
|
||||
libsm
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
install -Dm444 $src/favicon.png \
|
||||
$out/share/icons/hicolor/256x256/apps/discordchatexporter.png
|
||||
'';
|
||||
|
||||
postFixup =
|
||||
lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
ln -sf $out/bin/DiscordChatExporter $out/bin/discordchatexporter
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
rm $out/Applications/DiscordChatExporter.app/Contents/MacOS/DiscordChatExporter
|
||||
makeBinaryWrapper $out/bin/DiscordChatExporter $out/Applications/DiscordChatExporter.app/Contents/MacOS/DiscordChatExporter
|
||||
'';
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "discordchatexporter";
|
||||
desktopName = "DiscordChatExporter";
|
||||
comment = finalAttrs.meta.description;
|
||||
exec = "DiscordChatExporter";
|
||||
icon = "discordchatexporter";
|
||||
categories = [
|
||||
"Network"
|
||||
"Chat"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
passthru = {
|
||||
updateScript = _experimental-update-script-combinators.sequence [
|
||||
(gitUpdater { }).command
|
||||
(finalAttrs.passthru.fetch-deps)
|
||||
];
|
||||
};
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/Tyrrrz/DiscordChatExporter/releases/tag/${finalAttrs.version}";
|
||||
@@ -40,10 +113,8 @@ buildDotnetModule (finalAttrs: {
|
||||
maintainers = with lib.maintainers; [
|
||||
phanirithvij
|
||||
willow
|
||||
philocalyst
|
||||
];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
})
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
diff --git a/DiscordChatExporter.Gui/StartOptions.cs b/DiscordChatExporter.Gui/StartOptions.cs
|
||||
index d17752a..8df18c8 100644
|
||||
--- a/DiscordChatExporter.Gui/StartOptions.cs
|
||||
+++ b/DiscordChatExporter.Gui/StartOptions.cs
|
||||
@@ -21,7 +21,13 @@ public partial class StartOptions
|
||||
? Path.EndsInDirectorySeparator(path) || Directory.Exists(path)
|
||||
? Path.Combine(path, "Settings.dat")
|
||||
: path
|
||||
- : Path.Combine(AppContext.BaseDirectory, "Settings.dat"),
|
||||
+ : Path.Combine(
|
||||
+ System.IO.Path.Combine(
|
||||
+ Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
+ "discordchatexporter"
|
||||
+ ),
|
||||
+ "Settings.dat"
|
||||
+ ),
|
||||
IsAutoUpdateAllowed = !(
|
||||
Environment.GetEnvironmentVariable("DISCORDCHATEXPORTER_ALLOW_AUTO_UPDATE")
|
||||
is { } env
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/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" --file=./pkgs/by-name/di/discordchatexporter-desktop/package.nix
|
||||
$(nix-build -A discordchatexporter-desktop.fetch-deps --no-out-link)
|
||||
Reference in New Issue
Block a user