Skip to content

Commit 945db27

Browse files
authored
sourcegit: init at 2025.1 (#303865)
2 parents 5ecbe31 + c401748 commit 945db27

File tree

3 files changed

+380
-0
lines changed

3 files changed

+380
-0
lines changed

pkgs/by-name/so/sourcegit/deps.json

Lines changed: 232 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs
2+
index a24f1b6..4102274 100644
3+
--- a/src/Native/Linux.cs
4+
+++ b/src/Native/Linux.cs
5+
@@ -97,7 +97,7 @@ namespace SourceGit.Native
6+
}
7+
}
8+
9+
- private string FindExecutable(string filename)
10+
+ public static string FindExecutable(string filename)
11+
{
12+
var pathVariable = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
13+
var pathes = pathVariable.Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries);
14+
diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs
15+
index 5721fe8..bc2a57d 100644
16+
--- a/src/Native/MacOS.cs
17+
+++ b/src/Native/MacOS.cs
18+
@@ -25,12 +25,7 @@ namespace SourceGit.Native
19+
20+
public string FindGitExecutable()
21+
{
22+
- var gitPathVariants = new List<string>() {
23+
- "/usr/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git", "/opt/homebrew/opt/git/bin/git"
24+
- };
25+
- foreach (var path in gitPathVariants)
26+
- if (File.Exists(path)) return path;
27+
- return string.Empty;
28+
+ return Linux.FindExecutable("git");
29+
}
30+
31+
public string FindTerminal(Models.ShellOrTerminal shell)
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
lib,
3+
stdenv,
4+
buildDotnetModule,
5+
fetchFromGitHub,
6+
dotnetCorePackages,
7+
copyDesktopItems,
8+
makeDesktopItem,
9+
libicns,
10+
11+
libXcursor,
12+
libXext,
13+
libXi,
14+
libXrandr,
15+
16+
git,
17+
xdg-utils,
18+
}:
19+
20+
buildDotnetModule (finalAttrs: {
21+
pname = "sourcegit";
22+
version = "2025.01";
23+
24+
src = fetchFromGitHub {
25+
owner = "sourcegit-scm";
26+
repo = "sourcegit";
27+
tag = "v${finalAttrs.version}";
28+
hash = "sha256-6FO0WRUcWm7xnuw6Br97+cWZhvzIOesg/eANZzeyxZo=";
29+
};
30+
31+
patches = [ ./fix-darwin-git-path.patch ];
32+
33+
dotnet-sdk = dotnetCorePackages.sdk_9_0;
34+
dotnet-runtime = dotnetCorePackages.runtime_9_0;
35+
36+
nugetDeps = ./deps.json;
37+
38+
projectFile = [ "src/SourceGit.csproj" ];
39+
40+
executables = [ "SourceGit" ];
41+
42+
dotnetFlags = [
43+
"-p:DisableUpdateDetection=true"
44+
"-p:DisableAOT=true"
45+
];
46+
47+
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
48+
copyDesktopItems
49+
libicns
50+
];
51+
52+
# these are dlopen-ed at runtime
53+
# libXi is needed for right-click support
54+
# not sure about what the other ones are needed for, but I'll include them anyways
55+
runtimeDeps = [
56+
libXcursor
57+
libXext
58+
libXi
59+
libXrandr
60+
];
61+
62+
# Note: users can use `.overrideAttrs` to append to this list
63+
runtimePathDeps = [
64+
git
65+
xdg-utils
66+
];
67+
68+
# add fallback binaries to use if the user doesn't already have them in their PATH
69+
preInstall = ''
70+
makeWrapperArgs+=(
71+
--suffix PATH : ${lib.makeBinPath finalAttrs.runtimePathDeps}
72+
)
73+
'';
74+
75+
desktopItems = [
76+
(makeDesktopItem {
77+
name = "SourceGit";
78+
exec = "SourceGit";
79+
icon = "SourceGit";
80+
desktopName = "SourceGit";
81+
terminal = false;
82+
comment = finalAttrs.meta.description;
83+
})
84+
];
85+
86+
postInstall =
87+
lib.optionalString stdenv.hostPlatform.isLinux ''
88+
# extract the .icns file into multiple .png files
89+
# where the format of the .png file names is App_"$n"x"$n"x32.png
90+
91+
icns2png -x build/resources/app/App.icns
92+
93+
for f in App_*x32.png; do
94+
res=''${f//App_}
95+
res=''${res//x32.png}
96+
install -Dm644 $f "$out/share/icons/hicolor/$res/apps/SourceGit.png"
97+
done
98+
''
99+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
100+
install -Dm644 build/resources/app/App.icns $out/Applications/SourceGit.app/Contents/Resources/App.icns
101+
102+
substitute build/resources/app/App.plist $out/Applications/SourceGit.app/Contents/Info.plist \
103+
--replace-fail "SOURCE_GIT_VERSION" "${finalAttrs.version}"
104+
105+
mkdir -p $out/Applications/SourceGit.app/Contents/MacOS
106+
ln -s $out/bin/SourceGit $out/Applications/SourceGit.app/Contents/MacOS/SourceGit
107+
'';
108+
109+
meta = {
110+
changelog = "https://github.com/sourcegit-scm/sourcegit/releases/tag/${finalAttrs.src.tag}";
111+
description = "Free & OpenSource GUI client for GIT users";
112+
homepage = "https://github.com/sourcegit-scm/sourcegit";
113+
license = lib.licenses.mit;
114+
mainProgram = "SourceGit";
115+
maintainers = with lib.maintainers; [ tomasajt ];
116+
};
117+
})

0 commit comments

Comments
 (0)