1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5 nodejs,
6 makeWrapper,
7 versionCheckHook,
8 nix-update-script,
9}:
10buildNpmPackage (finalAttrs: {
11 pname = "jdenticon-cli";
12 version = "3.3.0";
13 src = fetchFromGitHub {
14 owner = "dmester";
15 repo = "jdenticon";
16 tag = finalAttrs.version;
17 hash = "sha256-uOPNsfEreC7F+Y0WWmudZSPnGxqarna0JPOwQyK6LiQ=";
18 };
19 npmDepsHash = "sha256-LXwvb088oHmA57EryfYtKi0L/9sB+yyUr/K/qGA1W9k=";
20
21 nativeBuildInputs = [
22 makeWrapper
23 nodejs
24 ];
25
26 installPhase = ''
27 runHook preInstall
28
29 install -D bin/jdenticon.js "$out/lib/jdenticon/bin/jdenticon.js"
30 install -D dist/jdenticon-node.js "$out/lib/jdenticon/dist/jdenticon-node.js"
31 install -d "$out/lib/jdenticon/node_modules"
32 cp -r node_modules/canvas-renderer "$out/lib/jdenticon/node_modules"
33 makeWrapper "${lib.getExe nodejs}" "$out/bin/jdenticon" \
34 --add-flags "$out/lib/jdenticon/bin/jdenticon.js"
35
36 runHook postInstall
37 '';
38
39 doInstallCheck = true;
40 nativeInstallCheckInputs = [ versionCheckHook ];
41
42 passthru.updateScript = nix-update-script { };
43
44 meta = {
45 changelog = "https://github.com/dmester/jdenticon/releases/tag/${finalAttrs.version}";
46 description = "JavaScript library for generating highly recognizable identicons using HTML5 canvas or SVG.";
47 homepage = "https://jdenticon.com/";
48 license = lib.licenses.mit;
49 maintainers = [ lib.maintainers.gipphe ];
50 mainProgram = "jdenticon";
51 };
52})