From c4017485fe051c2cf4e60d54d2955278623e58fe Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 19 Aug 2024 16:24:42 +0200 Subject: [PATCH] sourcegit: init at 2025.1 Co-Authored-By: Peter Kling <1018801+pitkling@users.noreply.github.com> --- pkgs/by-name/so/sourcegit/deps.json | 232 ++++++++++++++++++ .../so/sourcegit/fix-darwin-git-path.patch | 31 +++ pkgs/by-name/so/sourcegit/package.nix | 117 +++++++++ 3 files changed, 380 insertions(+) create mode 100644 pkgs/by-name/so/sourcegit/deps.json create mode 100644 pkgs/by-name/so/sourcegit/fix-darwin-git-path.patch create mode 100644 pkgs/by-name/so/sourcegit/package.nix diff --git a/pkgs/by-name/so/sourcegit/deps.json b/pkgs/by-name/so/sourcegit/deps.json new file mode 100644 index 000000000000..f76816c86853 --- /dev/null +++ b/pkgs/by-name/so/sourcegit/deps.json @@ -0,0 +1,232 @@ +[ + { + "pname": "Avalonia", + "version": "11.0.0", + "hash": "sha256-7QE0MtD1QDiG3gRx5xW33E33BXyEtASQSw+Wi3Lmy3E=" + }, + { + "pname": "Avalonia", + "version": "11.2.3", + "hash": "sha256-NUoyXJkIsgbkcKFVb10VRafM4ViHs801c/7vhu3ssUY=" + }, + { + "pname": "Avalonia.Angle.Windows.Natives", + "version": "2.1.22045.20230930", + "hash": "sha256-RxPcWUT3b/+R3Tu5E5ftpr5ppCLZrhm+OTsi0SwW3pc=" + }, + { + "pname": "Avalonia.AvaloniaEdit", + "version": "11.1.0", + "hash": "sha256-K9+hK+4aK93dyuGytYvVU25daz605+KN54hmwQYXFF8=" + }, + { + "pname": "Avalonia.BuildServices", + "version": "0.0.29", + "hash": "sha256-WPHRMNowRnYSCh88DWNBCltWsLPyOfzXGzBqLYE7tRY=" + }, + { + "pname": "Avalonia.Controls.ColorPicker", + "version": "11.2.3", + "hash": "sha256-z3ZHxVSOoOjqq+5G71jnGN1Y0i3YpAkox7cj3lNr6kg=" + }, + { + "pname": "Avalonia.Controls.DataGrid", + "version": "11.2.3", + "hash": "sha256-jIJvuYN0iym/WeOC0C7z5xj5kCZSXGoeLQ/q5qQfewM=" + }, + { + "pname": "Avalonia.Desktop", + "version": "11.2.3", + "hash": "sha256-srtZi+kDbhRtMl33l91zssBWETU5oHodKbbWyfEsb/I=" + }, + { + "pname": "Avalonia.Diagnostics", + "version": "11.2.3", + "hash": "sha256-DIGkaBff+C3BLwedw5xteR5lfzb6ecxiLt12eJVgLQc=" + }, + { + "pname": "Avalonia.Fonts.Inter", + "version": "11.2.3", + "hash": "sha256-ySsCXVpjqjCX/uYkwluSfrAoBtuq9k7fC1bFjxKC9/Q=" + }, + { + "pname": "Avalonia.FreeDesktop", + "version": "11.2.3", + "hash": "sha256-3sNemBmZE06w2ul87T5HrEeHUxXMOa9MfQhpI4AoxDY=" + }, + { + "pname": "Avalonia.Native", + "version": "11.2.3", + "hash": "sha256-2Gp98NGWcrILqF+P5PDMPRdsMby/lZiT3eWAUskFim8=" + }, + { + "pname": "Avalonia.Remote.Protocol", + "version": "11.2.3", + "hash": "sha256-dSeu7rnTD9rIvlyro2iFS52oi0vvfeaGV3kDm90BkKw=" + }, + { + "pname": "Avalonia.Skia", + "version": "11.0.0", + "hash": "sha256-A01nrs3Ij1eTo6tPmu7++T1K+Wo/H/9LvpeuOUGbQeU=" + }, + { + "pname": "Avalonia.Skia", + "version": "11.2.3", + "hash": "sha256-QBp8wTA92hGwbmNSVL4gsjrqA9CfwDPgdTiOEqcogGA=" + }, + { + "pname": "Avalonia.Themes.Fluent", + "version": "11.2.3", + "hash": "sha256-DRl+267mUtJDUJpreUj6BxDLGGYGkEEo5vDGtGguoC8=" + }, + { + "pname": "Avalonia.Themes.Simple", + "version": "11.2.3", + "hash": "sha256-UF15yTDzHmqd33siH3TJxmxaonA51dzga+hmCUahn1k=" + }, + { + "pname": "Avalonia.Win32", + "version": "11.2.3", + "hash": "sha256-xKFKObvqdJaQjphEktRJvzmAoDEsKg3WqlEG31V3qLE=" + }, + { + "pname": "Avalonia.X11", + "version": "11.2.3", + "hash": "sha256-SD4dmpKx4l8YOyUnrA0fnf2Bb+tHSNyARh7GAtHyg60=" + }, + { + "pname": "AvaloniaEdit.TextMate", + "version": "11.1.0", + "hash": "sha256-Nv52bUxA02VcsKCbMqEAkNBl46gznSivRZ3llLHrhkM=" + }, + { + "pname": "CommunityToolkit.Mvvm", + "version": "8.3.2", + "hash": "sha256-zY+iB5Rj/8ru0xpRWwFLFO6JI3UFB/XHnx9pWmrZCAs=" + }, + { + "pname": "HarfBuzzSharp", + "version": "7.3.0.2", + "hash": "sha256-ibgoqzT1NV7Qo5e7X2W6Vt7989TKrkd2M2pu+lhSDg8=" + }, + { + "pname": "HarfBuzzSharp", + "version": "7.3.0.3", + "hash": "sha256-1vDIcG1aVwVABOfzV09eAAbZLFJqibip9LaIx5k+JxM=" + }, + { + "pname": "HarfBuzzSharp.NativeAssets.Linux", + "version": "7.3.0.3", + "hash": "sha256-HW5r16wdlgDMbE/IfE5AQGDVFJ6TS6oipldfMztx+LM=" + }, + { + "pname": "HarfBuzzSharp.NativeAssets.macOS", + "version": "7.3.0.3", + "hash": "sha256-UpAVfRIYY8Wh8xD4wFjrXHiJcvlBLuc2Xdm15RwQ76w=" + }, + { + "pname": "HarfBuzzSharp.NativeAssets.WebAssembly", + "version": "7.3.0.3", + "hash": "sha256-jHrU70rOADAcsVfVfozU33t/5B5Tk0CurRTf4fVQe3I=" + }, + { + "pname": "HarfBuzzSharp.NativeAssets.Win32", + "version": "7.3.0.3", + "hash": "sha256-v/PeEfleJcx9tsEQAo5+7Q0XPNgBqiSLNnB2nnAGp+I=" + }, + { + "pname": "LiveChartsCore", + "version": "2.0.0-rc4.5", + "hash": "sha256-2Fgn9Bo1aM6dZHCU+OVykOhggTzpcEfFNfYtWc4yvHc=" + }, + { + "pname": "LiveChartsCore.SkiaSharpView", + "version": "2.0.0-rc4.5", + "hash": "sha256-03RR14tA0DtYHiLdgmAI4Gp5/e2H6QPkNFOBeqiFaJU=" + }, + { + "pname": "LiveChartsCore.SkiaSharpView.Avalonia", + "version": "2.0.0-rc4.5", + "hash": "sha256-lzG/5e6WDpUiHZ8GvovOMvwXyYoVBeB1Ktuuw2Fx5No=" + }, + { + "pname": "MicroCom.Runtime", + "version": "0.11.0", + "hash": "sha256-VdwpP5fsclvNqJuppaOvwEwv2ofnAI5ZSz2V+UEdLF0=" + }, + { + "pname": "Onigwrap", + "version": "1.0.6", + "hash": "sha256-p+dhMfIH4C6xLKRUREnUpC0DZwFazjvI+30KRT8TWnU=" + }, + { + "pname": "SkiaSharp", + "version": "2.88.8", + "hash": "sha256-rD5gc4SnlRTXwz367uHm8XG5eAIQpZloGqLRGnvNu0A=" + }, + { + "pname": "SkiaSharp", + "version": "2.88.9", + "hash": "sha256-jZ/4nVXYJtrz9SBf6sYc/s0FxS7ReIYM4kMkrhZS+24=" + }, + { + "pname": "SkiaSharp.HarfBuzz", + "version": "2.88.8", + "hash": "sha256-W9jNuEo/8q+k2aHNC19FfKcBUIEWx2zDcGwM+jDZ1o8=" + }, + { + "pname": "SkiaSharp.NativeAssets.Linux", + "version": "2.88.9", + "hash": "sha256-mQ/oBaqRR71WfS66mJCvcc3uKW7CNEHoPN2JilDbw/A=" + }, + { + "pname": "SkiaSharp.NativeAssets.macOS", + "version": "2.88.9", + "hash": "sha256-qvGuAmjXGjGKMzOPBvP9VWRVOICSGb7aNVejU0lLe/g=" + }, + { + "pname": "SkiaSharp.NativeAssets.WebAssembly", + "version": "2.88.9", + "hash": "sha256-vgFL4Pdy3O1RKBp+T9N3W4nkH9yurZ0suo8u3gPmmhY=" + }, + { + "pname": "SkiaSharp.NativeAssets.Win32", + "version": "2.88.9", + "hash": "sha256-kP5XM5GgwHGfNJfe4T2yO5NIZtiF71Ddp0pd1vG5V/4=" + }, + { + "pname": "System.IO.Pipelines", + "version": "8.0.0", + "hash": "sha256-LdpB1s4vQzsOODaxiKstLks57X9DTD5D6cPx8DE1wwE=" + }, + { + "pname": "System.Text.Json", + "version": "8.0.5", + "hash": "sha256-yKxo54w5odWT6nPruUVsaX53oPRe+gKzGvLnnxtwP68=" + }, + { + "pname": "TextMateSharp", + "version": "1.0.59", + "hash": "sha256-qfAGSgVpTrWMZSk0TFDVP1IgWWi6O1jEEvWc0Pvw9i0=" + }, + { + "pname": "TextMateSharp", + "version": "1.0.65", + "hash": "sha256-kZx3CBDzu7qUSnihs9Q4Ck78ih1aJ+0g8cN8Hke+E5w=" + }, + { + "pname": "TextMateSharp.Grammars", + "version": "1.0.59", + "hash": "sha256-ru5VxQK4PFRJhHu+MvCzDt3EwbC/94n1whtDovUAUDA=" + }, + { + "pname": "TextMateSharp.Grammars", + "version": "1.0.65", + "hash": "sha256-tZx/GKYX3bomQFVFaEgneNYHpB74v+8D90IfkYImlhE=" + }, + { + "pname": "Tmds.DBus.Protocol", + "version": "0.20.0", + "hash": "sha256-CRW/tkgsuBiBJfRwou12ozRQsWhHDooeP88E5wWpWJw=" + } +] diff --git a/pkgs/by-name/so/sourcegit/fix-darwin-git-path.patch b/pkgs/by-name/so/sourcegit/fix-darwin-git-path.patch new file mode 100644 index 000000000000..790fd218e789 --- /dev/null +++ b/pkgs/by-name/so/sourcegit/fix-darwin-git-path.patch @@ -0,0 +1,31 @@ +diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs +index a24f1b6..4102274 100644 +--- a/src/Native/Linux.cs ++++ b/src/Native/Linux.cs +@@ -97,7 +97,7 @@ namespace SourceGit.Native + } + } + +- private string FindExecutable(string filename) ++ public static string FindExecutable(string filename) + { + var pathVariable = Environment.GetEnvironmentVariable("PATH") ?? string.Empty; + var pathes = pathVariable.Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries); +diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs +index 5721fe8..bc2a57d 100644 +--- a/src/Native/MacOS.cs ++++ b/src/Native/MacOS.cs +@@ -25,12 +25,7 @@ namespace SourceGit.Native + + public string FindGitExecutable() + { +- var gitPathVariants = new List() { +- "/usr/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git", "/opt/homebrew/opt/git/bin/git" +- }; +- foreach (var path in gitPathVariants) +- if (File.Exists(path)) return path; +- return string.Empty; ++ return Linux.FindExecutable("git"); + } + + public string FindTerminal(Models.ShellOrTerminal shell) diff --git a/pkgs/by-name/so/sourcegit/package.nix b/pkgs/by-name/so/sourcegit/package.nix new file mode 100644 index 000000000000..72ac09617105 --- /dev/null +++ b/pkgs/by-name/so/sourcegit/package.nix @@ -0,0 +1,117 @@ +{ + lib, + stdenv, + buildDotnetModule, + fetchFromGitHub, + dotnetCorePackages, + copyDesktopItems, + makeDesktopItem, + libicns, + + libXcursor, + libXext, + libXi, + libXrandr, + + git, + xdg-utils, +}: + +buildDotnetModule (finalAttrs: { + pname = "sourcegit"; + version = "2025.01"; + + src = fetchFromGitHub { + owner = "sourcegit-scm"; + repo = "sourcegit"; + tag = "v${finalAttrs.version}"; + hash = "sha256-6FO0WRUcWm7xnuw6Br97+cWZhvzIOesg/eANZzeyxZo="; + }; + + patches = [ ./fix-darwin-git-path.patch ]; + + dotnet-sdk = dotnetCorePackages.sdk_9_0; + dotnet-runtime = dotnetCorePackages.runtime_9_0; + + nugetDeps = ./deps.json; + + projectFile = [ "src/SourceGit.csproj" ]; + + executables = [ "SourceGit" ]; + + dotnetFlags = [ + "-p:DisableUpdateDetection=true" + "-p:DisableAOT=true" + ]; + + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + copyDesktopItems + libicns + ]; + + # these are dlopen-ed at runtime + # libXi is needed for right-click support + # not sure about what the other ones are needed for, but I'll include them anyways + runtimeDeps = [ + libXcursor + libXext + libXi + libXrandr + ]; + + # Note: users can use `.overrideAttrs` to append to this list + runtimePathDeps = [ + git + xdg-utils + ]; + + # add fallback binaries to use if the user doesn't already have them in their PATH + preInstall = '' + makeWrapperArgs+=( + --suffix PATH : ${lib.makeBinPath finalAttrs.runtimePathDeps} + ) + ''; + + desktopItems = [ + (makeDesktopItem { + name = "SourceGit"; + exec = "SourceGit"; + icon = "SourceGit"; + desktopName = "SourceGit"; + terminal = false; + comment = finalAttrs.meta.description; + }) + ]; + + postInstall = + lib.optionalString stdenv.hostPlatform.isLinux '' + # extract the .icns file into multiple .png files + # where the format of the .png file names is App_"$n"x"$n"x32.png + + icns2png -x build/resources/app/App.icns + + for f in App_*x32.png; do + res=''${f//App_} + res=''${res//x32.png} + install -Dm644 $f "$out/share/icons/hicolor/$res/apps/SourceGit.png" + done + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + install -Dm644 build/resources/app/App.icns $out/Applications/SourceGit.app/Contents/Resources/App.icns + + substitute build/resources/app/App.plist $out/Applications/SourceGit.app/Contents/Info.plist \ + --replace-fail "SOURCE_GIT_VERSION" "${finalAttrs.version}" + + mkdir -p $out/Applications/SourceGit.app/Contents/MacOS + ln -s $out/bin/SourceGit $out/Applications/SourceGit.app/Contents/MacOS/SourceGit + ''; + + meta = { + changelog = "https://github.com/sourcegit-scm/sourcegit/releases/tag/${finalAttrs.src.tag}"; + description = "Free & OpenSource GUI client for GIT users"; + homepage = "https://github.com/sourcegit-scm/sourcegit"; + license = lib.licenses.mit; + mainProgram = "SourceGit"; + maintainers = with lib.maintainers; [ tomasajt ]; + }; +})