-
-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
264 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
lib, | ||
callPackage, | ||
pkgsCross, | ||
stdenvNoCC, | ||
buildDotnetModule, | ||
fetchFromGitHub, | ||
fetchpatch, | ||
dotnetCorePackages, | ||
|
||
is32Bit ? stdenvNoCC.hostPlatform.parsed.cpu.bits == 32, | ||
}: | ||
if (!stdenvNoCC.hostPlatform.isWindows) then | ||
callPackage ./wrapper.nix { | ||
inherit (if is32Bit then pkgsCross.mingw32 else pkgsCross.mingwW64) dnspy; | ||
inherit is32Bit; | ||
} | ||
else | ||
let | ||
self = buildDotnetModule { | ||
pname = "dnspy${lib.optionalString is32Bit "32"}"; | ||
version = "6.5.1"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "dnSpyEx"; | ||
repo = "dnSpy"; | ||
rev = "v${self.version}"; | ||
hash = "sha256-ttGQpwFLj7px1z+SZv1eelOkXA9bbG0F5nGUSNCsC6k="; | ||
fetchSubmodules = true; | ||
}; | ||
|
||
patches = [ | ||
# Disable WPF hardware acceleration when running dnSpy under Wine | ||
(fetchpatch { | ||
url = "https://github.com/dnSpyEx/dnSpy/commit/f20c00583c15d91214dee7e97e4f680a48e891a5.patch"; | ||
hash = "sha256-hpSXjm01ohePRmNopb0sm/KQM825gRm5kLznzauB81c="; | ||
}) | ||
|
||
# Add Liberation Mono as monospace font fallback for Wine compatibility | ||
(fetchpatch { | ||
url = "https://github.com/dnSpyEx/dnSpy/commit/5ea1e361a457c7602832be2768655410294c930b.patch"; | ||
hash = "sha256-FgDxqFlPPIWE91O4Ie6tIYIbD3O/U33i+3XtD1kB7is="; | ||
}) | ||
]; | ||
|
||
projectFile = [ | ||
"dnSpy/dnSpy/dnSpy.csproj" | ||
"dnSpy/dnSpy.Console/dnSpy.Console.csproj" | ||
|
||
"Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy/dnSpy.Decompiler.ILSpy.csproj" | ||
"Extensions/dnSpy.Analyzer/dnSpy.Analyzer.csproj" | ||
"Extensions/dnSpy.AsmEditor/dnSpy.AsmEditor.csproj" | ||
"Extensions/dnSpy.BamlDecompiler/dnSpy.BamlDecompiler.csproj" | ||
"Extensions/dnSpy.Debugger/dnSpy.Debugger/dnSpy.Debugger.csproj" | ||
"Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet/dnSpy.Debugger.DotNet.csproj" | ||
"Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/dnSpy.Debugger.DotNet.CorDebug.csproj" | ||
"Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.Mono/dnSpy.Debugger.DotNet.Mono.csproj" | ||
"Extensions/dnSpy.Scripting.Roslyn/dnSpy.Scripting.Roslyn.csproj" | ||
]; | ||
nugetDeps = ./deps.nix; | ||
|
||
dotnet-sdk = dotnetCorePackages.sdk_8_0; | ||
dotnet-runtime = | ||
with dotnetCorePackages; | ||
combinePackages [ | ||
runtime_8_0 | ||
windowsdesktop_8_0 | ||
]; | ||
|
||
dotnetFlags = [ "-p:TargetFramework=net8.0-windows" ]; | ||
|
||
meta = { | ||
description = ".NET debugger and assembly editor"; | ||
homepage = "https://github.com/dnSpyEx/dnSpy"; | ||
sourceProvenance = with lib.sourceTypes; [ | ||
fromSource | ||
binaryBytecode | ||
binaryNativeCode | ||
]; | ||
license = lib.licenses.gpl3Plus; | ||
maintainers = with lib.maintainers; [ js6pak ]; | ||
platforms = [ | ||
"x86_64-windows" | ||
"i686-windows" | ||
]; | ||
}; | ||
}; | ||
in | ||
self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
lib, | ||
buildPackages, | ||
stdenvNoCC, | ||
wineWow64Packages, | ||
writeShellScript, | ||
makeWrapper, | ||
copyDesktopItems, | ||
makeDesktopItem, | ||
nix-update, | ||
|
||
dnspy, | ||
is32Bit ? false, | ||
overrideWine ? wineWow64Packages.staging, | ||
}: | ||
let | ||
wine = overrideWine; | ||
|
||
wrapper = writeShellScript "dnspy-wrapper" '' | ||
export WINE="${lib.getExe wine}" | ||
export WINEPREFIX="''${DNSPY_HOME:-"''${XDG_DATA_HOME:-"''${HOME}/.local/share"}/dnSpy"}/wine" | ||
export WINEDEBUG=-all | ||
if [ ! -d "$WINEPREFIX" ]; then | ||
mkdir -p "$WINEPREFIX" | ||
${lib.getExe' wine "wineboot"} -u | ||
fi | ||
exec "$WINE" "''${ENTRYPOINT:-${dnspy}/bin/dnSpy.exe}" "$@" | ||
''; | ||
|
||
self = stdenvNoCC.mkDerivation { | ||
inherit (dnspy) pname version; | ||
|
||
dontUnpack = true; | ||
dontConfigure = true; | ||
dontBuild = true; | ||
|
||
nativeBuildInputs = [ | ||
makeWrapper | ||
copyDesktopItems | ||
]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
icon_name="dnSpy${lib.optionalString is32Bit "-x86"}" | ||
${lib.getExe' buildPackages.icoutils "icotool"} -x "${dnspy.src}/dnSpy/dnSpy/Images/$icon_name.ico" | ||
for f in "$icon_name"_*.png; do | ||
res=$(basename "$f" | cut -d "_" -f3 | cut -d "x" -f1-2) | ||
install -vD "$f" "$out/share/icons/hicolor/$res/apps/$pname.png" | ||
done | ||
install -vD "${wrapper}" "$out/bin/${self.meta.mainProgram}" | ||
runHook postInstall | ||
''; | ||
|
||
desktopItems = makeDesktopItem { | ||
name = self.pname; | ||
desktopName = "dnSpy" + (lib.optionalString is32Bit " (32-bit)"); | ||
comment = self.meta.description; | ||
icon = dnspy.pname; | ||
exec = self.meta.mainProgram; | ||
categories = [ "Development" ]; | ||
}; | ||
|
||
passthru = { | ||
unwrapped = dnspy; | ||
|
||
updateScript = writeShellScript "update-dnspy" '' | ||
${lib.getExe nix-update} "dnspy.unwrapped" | ||
"$(nix-build -A "$UPDATE_NIX_ATTR_PATH.unwrapped.fetch-deps" --no-out-link)" | ||
''; | ||
}; | ||
|
||
meta = dnspy.meta // { | ||
platforms = [ | ||
"x86_64-linux" | ||
"x86_64-darwin" | ||
]; | ||
mainProgram = self.pname; | ||
}; | ||
}; | ||
in | ||
self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
stdenv, | ||
pkgsCross, | ||
dnspy, | ||
}: | ||
if (stdenv.hostPlatform.isWindows) then | ||
pkgsCross.mingw32.dnspy | ||
else | ||
dnspy.override { is32Bit = true; } |