diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix index 3d2c931a4591..1c22a86b7dac 100644 --- a/pkgs/applications/editors/vscode/generic.nix +++ b/pkgs/applications/editors/vscode/generic.nix @@ -57,6 +57,7 @@ ripgrep, hasVsceSign ? false, patchVSCodePath ? true, + imagemagick, }: stdenv.mkDerivation ( @@ -249,6 +250,7 @@ stdenv.mkDerivation ( nativeBuildInputs = [ unzip + imagemagick ] ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook @@ -289,7 +291,13 @@ stdenv.mkDerivation ( # 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/${libraryName}/resources/app/resources/linux/code.png" "$out/share/pixmaps/${iconName}.png" + icon_file="$out/lib/${libraryName}/resources/app/resources/linux/code.png" + cp "$icon_file" "$out/share/pixmaps/${iconName}.png" + + # Dynamically determine size of icon and place in appropriate directory + size=$(identify -format "%wx%h" "$icon_file") + mkdir -p "$out/share/icons/hicolor/$size/apps" + cp "$icon_file" "$out/share/icons/hicolor/$size/apps/${iconName}.png" '' ) # Override the previously determined VSCODE_PATH with the one we know to be correct