From 8e72024b22cb0accd1de05f4f822d40b99caef14 Mon Sep 17 00:00:00 2001 From: ZHAO Jin-Xiang Date: Thu, 13 Feb 2025 15:20:02 +0800 Subject: [PATCH] windsurf: fix collision with vscode --- pkgs/applications/editors/vscode/generic.nix | 26 +++++++++++--------- pkgs/by-name/wi/windsurf/package.nix | 4 ++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix index c5f0c0b51673..8e2cc8d521ee 100644 --- a/pkgs/applications/editors/vscode/generic.nix +++ b/pkgs/applications/editors/vscode/generic.nix @@ -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; diff --git a/pkgs/by-name/wi/windsurf/package.nix b/pkgs/by-name/wi/windsurf/package.nix index 92cb26bffc61..3e4d6f4f1dc5 100644 --- a/pkgs/by-name/wi/windsurf/package.nix +++ b/pkgs/by-name/wi/windsurf/package.nix @@ -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";