mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-15 03:40:22 +00:00
vscode-extensions.chrischinchilla.vscode-pandoc: build from source (#549024)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
diff --git a/src/extension.ts b/src/extension.ts
|
||||
index 49637fa..c48c655 100644
|
||||
--- a/src/extension.ts
|
||||
+++ b/src/extension.ts
|
||||
@@ -375,7 +375,7 @@ function renderDoc(
|
||||
execFile(
|
||||
command,
|
||||
args,
|
||||
- { cwd: filePath },
|
||||
+ { cwd: filePath, env: { ...process.env, PATH: process.env.PATH ? `${process.env.PATH}${path.delimiter}@pandocBin@` : "@pandocBin@" } },
|
||||
function (error, stdout, stderr) {
|
||||
if (stdout !== null) {
|
||||
pandocOutputChannel.append(stdout.toString() + "\n");
|
||||
@@ -1,30 +1,70 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchFromGitHub,
|
||||
fetchNpmDeps,
|
||||
nix-update-script,
|
||||
nodejs,
|
||||
npmHooks,
|
||||
replaceVars,
|
||||
vsce,
|
||||
vscode-utils,
|
||||
jq,
|
||||
moreutils,
|
||||
pandoc,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "vscode-pandoc";
|
||||
publisher = "chrischinchilla";
|
||||
version = "0.7.3";
|
||||
hash = "sha256-TGkNYA96mzFtUoM+XPKXJ/AM+hbiLc6Lvk5YDxFUwcI=";
|
||||
let
|
||||
version = "0.7.3";
|
||||
src = stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
sourceName = "chrischinchilla-vscode-pandoc";
|
||||
name = "${finalAttrs.sourceName}-${finalAttrs.version}.vsix";
|
||||
pname = "${finalAttrs.sourceName}-vsix";
|
||||
inherit version;
|
||||
src = fetchFromGitHub {
|
||||
owner = "ChrisChinchilla";
|
||||
repo = "vscode-pandoc";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-tn3qQzbwjUnbuZtwCs4kXiGcrR/pTDECoHIirG/0WrU=";
|
||||
};
|
||||
patches = [
|
||||
(replaceVars ./add-pandoc-to-path.patch {
|
||||
pandocBin = lib.makeBinPath [ pandoc ];
|
||||
})
|
||||
];
|
||||
npmDeps = fetchNpmDeps {
|
||||
inherit (finalAttrs) src;
|
||||
hash = "sha256-1j+bDx2CiViEgLfanyx0dwLRgY1aYV9rQDWP3nDl1Bw=";
|
||||
};
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
npmHooks.npmConfigHook
|
||||
vsce
|
||||
];
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
dontConfigure = true;
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
vsce package --no-dependencies --out $out
|
||||
runHook postBuild
|
||||
'';
|
||||
dontInstall = true;
|
||||
});
|
||||
in
|
||||
vscode-utils.buildVscodeExtension (finalAttrs: {
|
||||
pname = "chrischinchilla-vscode-pandoc";
|
||||
inherit version src;
|
||||
vscodeExtPublisher = "chrischinchilla";
|
||||
vscodeExtName = "vscode-pandoc";
|
||||
vscodeExtUniqueId = "${finalAttrs.vscodeExtPublisher}.${finalAttrs.vscodeExtName}";
|
||||
buildInputs = [ pandoc ]; # The Nix path scanner can't see into the VSIX.
|
||||
passthru.updateScript = nix-update-script {
|
||||
attrPath = "vscode-extensions.chrischinchilla.vscode-pandoc.src";
|
||||
};
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
moreutils
|
||||
];
|
||||
postInstall = ''
|
||||
jq '.contributes.configuration.properties."pandoc.executable".default = "${lib.getExe pandoc}"' $out/$installPrefix/package.json | sponge $out/$installPrefix/package.json
|
||||
'';
|
||||
meta = {
|
||||
description = "Converts Markdown files to pdf, docx, or html files using pandoc";
|
||||
homepage = "https://github.com/ChrisChinchilla/vscode-pandoc#readme";
|
||||
downloadPage = "https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf";
|
||||
downloadPage = "https://marketplace.visualstudio.com/items?itemName=chrischinchilla.vscode-pandoc";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ pandapip1 ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user