Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
146 lines
4.7 KiB
Nix
146 lines
4.7 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
vscode-utils,
|
|
autoPatchelfHook,
|
|
icu,
|
|
openssl,
|
|
libz,
|
|
glibc,
|
|
libxml2,
|
|
libkrb5,
|
|
patchelf,
|
|
}:
|
|
let
|
|
extInfo = (
|
|
{
|
|
x86_64-linux = {
|
|
arch = "linux-x64";
|
|
hash = "sha256-4yljDypIsx2bFKgCe0nL7Ljnzq6+efMRMBlpl1T6mU0=";
|
|
};
|
|
aarch64-linux = {
|
|
arch = "linux-arm64";
|
|
hash = "sha256-heiercuubJUhzOiRNPRvcBQfvbOtM6albpWvOkHlgsI=";
|
|
};
|
|
x86_64-darwin = {
|
|
arch = "darwin-x64";
|
|
hash = "sha256-U3VA9GjyP00bhZid3mdODLfmFW5WmtXmikPByDjELXA=";
|
|
};
|
|
aarch64-darwin = {
|
|
arch = "darwin-arm64";
|
|
hash = "sha256-uCOQnQ8x5OGPl/139jAZ12PdbWczS2KOQHLFxjEQnL4=";
|
|
};
|
|
}
|
|
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}")
|
|
);
|
|
in
|
|
vscode-utils.buildVscodeMarketplaceExtension {
|
|
mktplcRef = {
|
|
name = "csdevkit";
|
|
publisher = "ms-dotnettools";
|
|
version = "1.50.51";
|
|
inherit (extInfo) hash arch;
|
|
};
|
|
sourceRoot = "extension"; # This has more than one folder.
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
|
autoPatchelfHook
|
|
patchelf
|
|
];
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
|
(lib.getLib glibc) # libgcc_s.so.1
|
|
(lib.getLib icu) # libicui18n.so libicuuc.so
|
|
(lib.getLib libkrb5) # libgssapi_krb5.so
|
|
(lib.getLib libxml2) # libxml2.so.2
|
|
(lib.getLib libz) # libz.so.1
|
|
(lib.getLib openssl) # libopenssl.so.3
|
|
(lib.getLib stdenv.cc.cc) # libstdc++.so.6
|
|
];
|
|
|
|
postPatch = ''
|
|
declare ext_unique_id
|
|
ext_unique_id="$(basename "$out" | head -c 32)"
|
|
|
|
substituteInPlace dist/extension.js \
|
|
--replace-fail 'e.extensionPath,"cache"' 'require("os").tmpdir(),"'"$ext_unique_id"'"' \
|
|
--replace-fail 't.setExecuteBit=async function(e){if("win32"!==process.platform){const t=i.join(e[a.SERVICEHUB_CONTROLLER_COMPONENT_NAME],"Microsoft.VisualStudio.Code.ServiceController"),r=i.join(e[a.SERVICEHUB_HOST_COMPONENT_NAME],(0,a.getServiceHubHostEntrypointName)()),n=[(0,a.getServerPath)(e),t,r,(0,c.getReliabilityMonitorPath)(e)];await Promise.all(n.map((e=>(0,o.chmod)(e,"0755"))))}}' 't.setExecuteBit=async function(e){}'
|
|
'';
|
|
|
|
preFixup = ''
|
|
(
|
|
set -euo pipefail
|
|
shopt -s globstar
|
|
shopt -s dotglob
|
|
|
|
# Fix all binaries.
|
|
for file in "$out"/**/*; do
|
|
if [[ ! -f "$file" || "$file" == *.so || "$file" == *.a || "$file" == *.dylib ]] ||
|
|
(! isELF "$file" && ! isMachO "$file"); then
|
|
continue
|
|
fi
|
|
|
|
echo Making "$file" executable...
|
|
chmod +x "$file"
|
|
|
|
${lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
# Add .NET deps if it is an apphost.
|
|
if grep 'You must install .NET to run this application.' "$file" > /dev/null; then
|
|
echo "Adding .NET needed libraries to: $file"
|
|
patchelf \
|
|
--add-needed libicui18n.so \
|
|
--add-needed libicuuc.so \
|
|
--add-needed libgssapi_krb5.so \
|
|
--add-needed libssl.so \
|
|
"$file"
|
|
fi
|
|
''}
|
|
done
|
|
|
|
${lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
# Add the ICU libraries as needed to the globalization DLLs.
|
|
for file in "$out"/**/{libcoreclr.so,*System.Globalization.Native.so}; do
|
|
echo "Adding ICU libraries to: $file"
|
|
patchelf \
|
|
--add-needed libicui18n.so \
|
|
--add-needed libicuuc.so \
|
|
"$file"
|
|
done
|
|
|
|
# Add the Kerberos libraries as needed to the native security DLL.
|
|
for file in "$out"/**/*System.Net.Security.Native.so; do
|
|
echo "Adding Kerberos libraries to: $file"
|
|
patchelf \
|
|
--add-needed libgssapi_krb5.so \
|
|
"$file"
|
|
done
|
|
|
|
# Add the OpenSSL libraries as needed to the OpenSSL native security DLL.
|
|
for file in "$out"/**/*System.Security.Cryptography.Native.OpenSsl.so; do
|
|
echo "Adding OpenSSL libraries to: $file"
|
|
patchelf \
|
|
--add-needed libssl.so \
|
|
"$file"
|
|
done
|
|
|
|
# Fix libxml2 breakage. See https://github.com/NixOS/nixpkgs/pull/396195#issuecomment-2881757108
|
|
mkdir -p "$out/lib"
|
|
ln -s "${lib.getLib libxml2}/lib/libxml2.so" "$out/lib/libxml2.so.2"
|
|
''}
|
|
)
|
|
'';
|
|
|
|
meta = {
|
|
changelog = "https://marketplace.visualstudio.com/items/ms-dotnettools.csdevkit/changelog";
|
|
description = "Official Visual Studio Code extension for C# from Microsoft";
|
|
downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit";
|
|
license = lib.licenses.unfree;
|
|
maintainers = with lib.maintainers; [ ggg ];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
};
|
|
}
|