From 92f9f2fe111d2603feb2ee8cb2fc6ea5cc000e44 Mon Sep 17 00:00:00 2001 From: Florian Beeres Date: Thu, 24 Jun 2021 08:45:06 +0200 Subject: [PATCH] vscode: fix source name This commit fixes various long standing issues with the handling of executable names in the source archive. Depending on whether you install code or codium the executables are named differently. This commit let's us customize the source exe name in the generic VSCode derivation, but keeps the generated executableName intact. --- pkgs/applications/editors/vscode/generic.nix | 7 +++++-- pkgs/applications/editors/vscode/vscode.nix | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix index 56a81f21febb..d9a4ed2a8948 100644 --- a/pkgs/applications/editors/vscode/generic.nix +++ b/pkgs/applications/editors/vscode/generic.nix @@ -10,6 +10,9 @@ # Attributes inherit from specific versions , version, src, meta, sourceRoot , executableName, longName, shortName, pname, updateScript +# sourceExecutableName is the name of the binary in the source archive, over +# which we have no control +, sourceExecutableName ? executableName }: let @@ -77,12 +80,12 @@ let '' + (if system == "x86_64-darwin" then '' mkdir -p "$out/Applications/${longName}.app" $out/bin cp -r ./* "$out/Applications/${longName}.app" - ln -s "$out/Applications/${longName}.app/Contents/Resources/app/bin/${executableName}" $out/bin/${executableName} + ln -s "$out/Applications/${longName}.app/Contents/Resources/app/bin/${sourceExecutableName}" $out/bin/${executableName} '' else '' mkdir -p $out/lib/vscode $out/bin cp -r ./* $out/lib/vscode - ln -s $out/lib/vscode/bin/${executableName} $out/bin + ln -s $out/lib/vscode/bin/${sourceExecutableName} $out/bin/${executableName} mkdir -p $out/share/applications ln -s $desktopItem/share/applications/${executableName}.desktop $out/share/applications/${executableName}.desktop diff --git a/pkgs/applications/editors/vscode/vscode.nix b/pkgs/applications/editors/vscode/vscode.nix index 1a4b3e6c0616..85804f3bf2fc 100644 --- a/pkgs/applications/editors/vscode/vscode.nix +++ b/pkgs/applications/editors/vscode/vscode.nix @@ -25,6 +25,7 @@ in version = "1.57.1"; pname = "vscode"; + sourceExecutableName = "code"; executableName = "code" + lib.optionalString isInsiders "-insiders"; longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders"; shortName = "Code" + lib.optionalString isInsiders " - Insiders";