nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 nix-update-script,
5 fetchYarnDeps,
6 fetchFromGitHub,
7 yarnConfigHook,
8 npmHooks,
9 nodejs,
10 zip,
11 file,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "vivify";
16 version = "0.12.0";
17
18 src = fetchFromGitHub {
19 owner = "jannis-baum";
20 repo = "Vivify";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-h36kI8Pglo6Mvngg1whjMVjI0bv0v0+yPJCZTZ0BpUA=";
23 };
24
25 yarnOfflineCache = fetchYarnDeps {
26 yarnLock = "${finalAttrs.src}/yarn.lock";
27 hash = "sha256-RPi1yS1eKSwe/w0gzLhr0BGL00tHzpWAnaN3BEs7IWc=";
28 };
29
30 installPhase = ''
31 runHook preInstall
32
33 yarn install
34
35 substituteInPlace node_modules/.bin/tsc \
36 --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}'
37
38 substituteInPlace node_modules/.bin/webpack \
39 --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}'
40
41 substituteInPlace node_modules/.bin/postject \
42 --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}'
43
44 make VIV_VERSION=${finalAttrs.version} linux
45
46 mkdir -p $out/bin
47 install -Dm755 ./build/linux/viv $out/bin/viv
48 install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server
49
50 wrapProgram $out/bin/viv \
51 --prefix PATH : ${
52 lib.makeBinPath [
53 nodejs
54 file
55 ]
56 }
57 '';
58
59 nativeBuildInputs = [
60 yarnConfigHook
61 npmHooks.npmInstallHook
62 zip
63
64 nodejs
65 file
66 ];
67
68 # Stripping 'unneeded symbols' causes vivify-server executable to break
69 # (segmentation fault)
70 dontStrip = true;
71
72 passthru.updateScript = nix-update-script { };
73
74 meta = {
75 description = "Live Markdown viewer";
76 longDescription = ''
77 Vivify brings your files to life in the browser!
78 Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also
79 serve as a directory browser and let you view code files with syntax highlighting.
80 '';
81 homepage = "https://github.com/jannis-baum/Vivify";
82 changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}";
83 license = lib.licenses.gpl3;
84 maintainers = with lib.maintainers; [ skohtv ];
85 platforms = lib.platforms.linux;
86 mainProgram = "viv";
87 };
88})