2022-07-14 12:49:19 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkgs, nodejs-14_x, pandoc, CoreServices }:
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
# Note for maintainers:
|
|
|
|
# * keep version in sync with the ldgallery compiler
|
|
|
|
# * regenerate node-*.nix with `./generate.sh <git release tag>`
|
|
|
|
sourcePkg = fetchFromGitHub {
|
|
|
|
owner = "pacien";
|
|
|
|
repo = "ldgallery";
|
|
|
|
rev = "v2.0";
|
|
|
|
sha256 = "1a82wy6ns1434gdba2l04crvr5waf03y02bappcxqci2cfb1cznz";
|
|
|
|
};
|
|
|
|
|
|
|
|
nodePackages = import ./node-composition.nix {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
|
|
|
|
# some native node dependencies still require NodeJS 12 with Python 2
|
2022-07-14 12:49:19 +00:00
|
|
|
nodejs = nodejs-14_x;
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodePkg = nodePackages.package.override {
|
|
|
|
src = "${sourcePkg}/viewer";
|
|
|
|
postInstall = "npm run build";
|
2021-05-28 09:39:13 +00:00
|
|
|
buildInputs = optionals stdenv.isDarwin [ CoreServices ];
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
# making sure that the source and the node package are in sync
|
|
|
|
assert versions.majorMinor nodePkg.version == removePrefix "v" sourcePkg.rev;
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = nodePkg.packageName;
|
|
|
|
version = nodePkg.version;
|
|
|
|
src = nodePkg;
|
|
|
|
|
|
|
|
buildInputs = [ pandoc ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/share/ldgallery"
|
|
|
|
cp -rp "lib/node_modules/ldgallery-viewer/dist" \
|
|
|
|
"$out/share/ldgallery/viewer/"
|
|
|
|
cp -rp "lib/node_modules/ldgallery-viewer/examples" \
|
|
|
|
"$out/share/ldgallery/viewer/"
|
|
|
|
|
|
|
|
mkdir -p "$out/share/man/man7"
|
|
|
|
pandoc --standalone --to man \
|
|
|
|
"lib/node_modules/ldgallery-viewer/ldgallery-viewer.7.md" \
|
|
|
|
--output "$out/share/man/man7/ldgallery-viewer.7"
|
|
|
|
'';
|
|
|
|
}
|