windsurf: fix collision with vscode

This commit is contained in:
ZHAO Jin-Xiang
2025-02-13 17:29:50 +08:00
parent 1c513c0f56
commit 8e72024b22
2 changed files with 17 additions and 13 deletions
+14 -12
View File
@@ -42,6 +42,8 @@
longName,
shortName,
pname,
libraryName ? "vscode",
iconName ? "vs${executableName}",
updateScript,
dontFixup ? false,
rev ? null,
@@ -154,7 +156,7 @@ stdenv.mkDerivation (
comment = "Code Editing. Redefined.";
genericName = "Text Editor";
exec = "${executableName} %F";
icon = "vs${executableName}";
icon = iconName;
startupNotify = true;
startupWMClass = shortName;
categories = [
@@ -167,7 +169,7 @@ stdenv.mkDerivation (
actions.new-empty-window = {
name = "New Empty Window";
exec = "${executableName} --new-window %F";
icon = "vs${executableName}";
icon = iconName;
};
})
(makeDesktopItem {
@@ -176,7 +178,7 @@ stdenv.mkDerivation (
comment = "Code Editing. Redefined.";
genericName = "Text Editor";
exec = executableName + " --open-url %U";
icon = "vs${executableName}";
icon = iconName;
startupNotify = true;
startupWMClass = shortName;
categories = [
@@ -185,7 +187,7 @@ stdenv.mkDerivation (
"Development"
"IDE"
];
mimeTypes = [ "x-scheme-handler/vs${executableName}" ];
mimeTypes = [ "x-scheme-handler/${iconName}" ];
keywords = [ "vscode" ];
noDisplay = true;
})
@@ -244,23 +246,23 @@ stdenv.mkDerivation (
''
else
''
mkdir -p "$out/lib/vscode" "$out/bin"
cp -r ./* "$out/lib/vscode"
mkdir -p "$out/lib/${libraryName}" "$out/bin"
cp -r ./* "$out/lib/${libraryName}"
ln -s "$out/lib/vscode/bin/${sourceExecutableName}" "$out/bin/${executableName}"
ln -s "$out/lib/${libraryName}/bin/${sourceExecutableName}" "$out/bin/${executableName}"
# These are named vscode.png, vscode-insiders.png, etc to match the name in upstream *.deb packages.
mkdir -p "$out/share/pixmaps"
cp "$out/lib/vscode/resources/app/resources/linux/code.png" "$out/share/pixmaps/vs${executableName}.png"
cp "$out/lib/${libraryName}/resources/app/resources/linux/code.png" "$out/share/pixmaps/${iconName}.png"
# Override the previously determined VSCODE_PATH with the one we know to be correct
sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}"
grep -q "VSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" # check if sed succeeded
sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/${libraryName}'" "$out/bin/${executableName}"
grep -q "VSCODE_PATH='$out/lib/${libraryName}'" "$out/bin/${executableName}" # check if sed succeeded
# Remove native encryption code, as it derives the key from the executable path which does not work for us.
# The credentials should be stored in a secure keychain already, so the benefit of this is questionable
# in the first place.
rm -rf $out/lib/vscode/resources/app/node_modules/vscode-encrypt
rm -rf $out/lib/${libraryName}/resources/app/node_modules/vscode-encrypt
''
)
+ ''
@@ -327,7 +329,7 @@ stdenv.mkDerivation (
--add-needed ${libglvnd}/lib/libGLESv2.so.2 \
--add-needed ${libglvnd}/lib/libGL.so.1 \
--add-needed ${libglvnd}/lib/libEGL.so.1 \
$out/lib/vscode/${executableName}
$out/lib/${libraryName}/${executableName}
'';
inherit meta;
+3 -1
View File
@@ -13,7 +13,7 @@ let
(lib.importJSON ./info.json)."${stdenv.hostPlatform.system}"
or (throw "windsurf: unsupported system ${stdenv.hostPlatform.system}");
in
callPackage vscode-generic rec {
callPackage vscode-generic {
inherit commandLineArgs useVSCodeRipgrep;
inherit (info) version vscodeVersion;
@@ -22,6 +22,8 @@ callPackage vscode-generic rec {
executableName = "windsurf";
longName = "Windsurf";
shortName = "windsurf";
libraryName = "windsurf";
iconName = "windsurf";
sourceRoot = if stdenv.hostPlatform.isDarwin then "Windsurf.app" else "Windsurf";