Submit/fix vega lite (#139876)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Benjamin Kober <kober@optisense.com>
This commit is contained in:
Benjamin Kober 2021-10-03 18:59:02 +02:00 committed by GitHub
parent 685afcd4c2
commit ba1029a81a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 10 deletions

@ -387,18 +387,19 @@ let
};
vega-lite = super.vega-lite.override {
# npx tries to install vega from scratch at vegalite runtime if it
# can't find it. We thus replace it with a direct call to the nix
# derivation. This might not be necessary anymore in future vl
# versions: https://github.com/vega/vega-lite/issues/6863.
postInstall = ''
substituteInPlace $out/lib/node_modules/vega-lite/bin/vl2pdf \
--replace "npx -p vega vg2pdf" "${self.vega-cli}/bin/vg2pdf"
substituteInPlace $out/lib/node_modules/vega-lite/bin/vl2svg \
--replace "npx -p vega vg2svg" "${self.vega-cli}/bin/vg2svg"
substituteInPlace $out/lib/node_modules/vega-lite/bin/vl2png \
--replace "npx -p vega vg2png" "${self.vega-cli}/bin/vg2png"
cd node_modules
for dep in ${self.vega-cli}/lib/node_modules/vega-cli/node_modules/*; do
if [[ ! -d $dep ]]; then
ln -s "${self.vega-cli}/lib/node_modules/vega-cli/node_modules/$dep"
fi
done
'';
passthru.tests = {
simple-execution = pkgs.callPackage ./package-tests/vega-lite.nix {
inherit (self) vega-lite;
};
};
};
webtorrent-cli = super.webtorrent-cli.override {

@ -0,0 +1,24 @@
{ runCommand, vega-lite }:
let
inherit (vega-lite) packageName version;
in
runCommand "${packageName}-tests" { meta.timeout = 60; }
''
# get version of installed program and compare with package version
claimed_version="$(${vega-lite}/bin/vl2vg --version)"
if [[ "$claimed_version" != "${version}" ]]; then
echo "Error: program version does not match package version ($claimed_version != ${version})"
exit 1
fi
# run dummy commands
${vega-lite}/bin/vl2vg --help > /dev/null
${vega-lite}/bin/vl2svg --help > /dev/null
${vega-lite}/bin/vl2png --help > /dev/null
${vega-lite}/bin/vl2pdf --help > /dev/null
# needed for Nix to register the command as successful
touch $out
''