2022-09-30 11:47:45 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkgs, pandoc, CoreServices }:
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
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";
|
2022-09-30 11:47:45 +00:00
|
|
|
rev = "v2.1";
|
|
|
|
sha256 = "sha256-i+Boo+Mpx/EL+LBajtOQJfpi4EF5AVtRnGtyXKD2n6A=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodePackages = import ./node-composition.nix {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
};
|
|
|
|
|
|
|
|
nodePkg = nodePackages.package.override {
|
|
|
|
src = "${sourcePkg}/viewer";
|
|
|
|
postInstall = "npm run build";
|
2023-02-02 18:25:31 +00:00
|
|
|
buildInputs = lib.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
|
2023-02-02 18:25:31 +00:00
|
|
|
assert lib.versions.majorMinor nodePkg.version == lib.removePrefix "v" sourcePkg.rev;
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
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/"
|
2022-09-30 11:47:45 +00:00
|
|
|
cp -rp "${sourcePkg}/example" \
|
2021-01-05 17:05:55 +00:00
|
|
|
"$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"
|
|
|
|
'';
|
|
|
|
}
|