nixpkgs/pkgs/tools/graphics/ldgallery/viewer/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.4 KiB
Nix
Raw Normal View History

2022-09-20 19:00:59 +00:00
{ lib, stdenv, fetchFromGitHub, pkgs, pandoc, CoreServices }:
2020-09-25 14:34:39 +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";
2022-09-20 19:00:59 +00:00
rev = "v2.1";
sha256 = "sha256-i+Boo+Mpx/EL+LBajtOQJfpi4EF5AVtRnGtyXKD2n6A=";
2020-09-25 14:34:39 +00:00
};
nodePackages = import ./node-composition.nix {
inherit pkgs;
inherit (stdenv.hostPlatform) system;
};
nodePkg = nodePackages.package.override {
src = "${sourcePkg}/viewer";
postInstall = "npm run build";
buildInputs = optionals stdenv.isDarwin [ CoreServices ];
2020-09-25 14:34:39 +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/"
2022-09-20 19:00:59 +00:00
cp -rp "${sourcePkg}/example" \
2020-09-25 14:34:39 +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"
'';
}