|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + buildDotnetModule, |
| 5 | + fetchFromGitHub, |
| 6 | + dotnetCorePackages, |
| 7 | + autoPatchelfHook, |
| 8 | + copyDesktopItems, |
| 9 | + icu, |
| 10 | + openssl, |
| 11 | + libkrb5, |
| 12 | + makeDesktopItem, |
| 13 | + writeShellScript, |
| 14 | + nix-update, |
| 15 | +}: |
| 16 | +buildDotnetModule (finalAttrs: rec { |
| 17 | + pname = "msbuild-structured-log-viewer"; |
| 18 | + version = "2.2.383"; |
| 19 | + |
| 20 | + src = fetchFromGitHub { |
| 21 | + owner = "KirillOsenkov"; |
| 22 | + repo = "MSBuildStructuredLog"; |
| 23 | + rev = "v${version}"; |
| 24 | + hash = "sha256-re1owocdiPKwoORCPD+A0eiRi4Nk4i9a1l0XTQJcxqE="; |
| 25 | + }; |
| 26 | + |
| 27 | + dotnet-sdk = dotnetCorePackages.sdk_8_0; |
| 28 | + dotnet-runtime = dotnetCorePackages.runtime_8_0; |
| 29 | + |
| 30 | + projectFile = [ "src/StructuredLogViewer.Avalonia/StructuredLogViewer.Avalonia.csproj" ]; |
| 31 | + nugetDeps = ./deps.nix; |
| 32 | + |
| 33 | + # HACK: Clear out RuntimeIdentifiers that's set in StructuredLogViewer.Avalonia.csproj, otherwise our --runtime has no effect |
| 34 | + dotnetFlags = [ "-p:RuntimeIdentifiers=" ]; |
| 35 | + |
| 36 | + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ |
| 37 | + autoPatchelfHook |
| 38 | + copyDesktopItems |
| 39 | + ]; |
| 40 | + |
| 41 | + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ |
| 42 | + stdenv.cc.cc.lib |
| 43 | + icu |
| 44 | + openssl |
| 45 | + libkrb5 |
| 46 | + ]; |
| 47 | + |
| 48 | + dontDotnetFixup = true; |
| 49 | + |
| 50 | + postFixup = |
| 51 | + '' |
| 52 | + wrapDotnetProgram $out/lib/${finalAttrs.pname}/StructuredLogViewer.Avalonia $out/bin/${meta.mainProgram} |
| 53 | + '' |
| 54 | + + lib.optionalString stdenv.hostPlatform.isLinux '' |
| 55 | + install -Dm444 $src/src/StructuredLogViewer/icons/msbuild-structured-log-viewer.png $out/share/icons/hicolor/32x32/apps/${finalAttrs.pname}.png |
| 56 | + '' |
| 57 | + + lib.optionalString stdenv.hostPlatform.isDarwin '' |
| 58 | + substituteInPlace src/StructuredLogViewer.Avalonia/Info.plist \ |
| 59 | + --replace-fail "0.0.1" "${finalAttrs.version}" |
| 60 | +
|
| 61 | + install -Dm444 src/StructuredLogViewer.Avalonia/Info.plist $out/Applications/StructuredLogViewer.app/Contents/Info.plist |
| 62 | + install -Dm444 src/StructuredLogViewer.Avalonia/StructuredLogViewer.icns $out/Applications/StructuredLogViewer.app/Contents/Resources/StructuredLogViewer.icns |
| 63 | + mkdir -p $out/Applications/StructuredLogViewer.app/Contents/MacOS |
| 64 | + ln -s $out/bin/${meta.mainProgram} $out/Applications/StructuredLogViewer.app/Contents/MacOS/StructuredLogViewer.Avalonia |
| 65 | + ''; |
| 66 | + |
| 67 | + desktopItems = makeDesktopItem { |
| 68 | + name = finalAttrs.pname; |
| 69 | + desktopName = "MSBuild Structured Log Viewer"; |
| 70 | + comment = finalAttrs.meta.description; |
| 71 | + icon = finalAttrs.pname; |
| 72 | + exec = meta.mainProgram; |
| 73 | + categories = [ "Development" ]; |
| 74 | + }; |
| 75 | + |
| 76 | + passthru.updateScript = writeShellScript "update-${finalAttrs.pname}" '' |
| 77 | + ${lib.getExe nix-update} |
| 78 | + "$(nix-build -A "$UPDATE_NIX_ATTR_PATH.fetch-deps" --no-out-link)" |
| 79 | + ''; |
| 80 | + |
| 81 | + meta = { |
| 82 | + description = "Rich interactive log viewer for MSBuild logs"; |
| 83 | + homepage = "https://github.com/KirillOsenkov/MSBuildStructuredLog"; |
| 84 | + changelog = "https://github.com/KirillOsenkov/MSBuildStructuredLog/releases/tag/v${finalAttrs.version}"; |
| 85 | + sourceProvenance = with lib.sourceTypes; [ |
| 86 | + fromSource |
| 87 | + binaryBytecode |
| 88 | + binaryNativeCode |
| 89 | + ]; |
| 90 | + license = lib.licenses.mit; |
| 91 | + maintainers = with lib.maintainers; [ js6pak ]; |
| 92 | + mainProgram = "msbuild-structured-log-viewer"; |
| 93 | + }; |
| 94 | +}) |
0 commit comments