From 4bdd5fab0197bb0b0f288307396f57a9e6a0fa3a Mon Sep 17 00:00:00 2001 From: Tomas Rivera <137088692+Totorile1@users.noreply.github.com> Date: Sun, 19 Apr 2026 11:58:55 +0200 Subject: [PATCH] Manual derivation for Vivify 0.14.0 (which is still not on unstable --- hosts/laptop/configuration.nix | 4 +- hosts/laptop/home.nix | 1 + modules/packages/README.md | 3 ++ modules/packages/vivify.nix | 88 ++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 modules/packages/README.md create mode 100644 modules/packages/vivify.nix diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index b4a7192..55bdb92 100755 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -227,7 +227,6 @@ ])) iamb # matrix client direnv - vivify # for nvimnotes # utils for dev pkg-config gdb @@ -258,6 +257,9 @@ papirus-folders inkscape birdtray # thunderbird tray app + #vivify # for NoteWrapper + # this is more up to date + (callPackage ../../modules/packages/vivify.nix {}) ]; # fonts diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 121153e..f3068ea 100755 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -84,6 +84,7 @@ (pkgs.callPackage ../../modules/scripts/man.nix {}) (pkgs.callPackage ../../modules/scripts/trimmer.nix {}) (pkgs.callPackage ../../modules/qt/qtbatticon.nix {}) + #(pkgs.callPackage ../../modules/scripts/obsidianbackup.nix {}) # periodically syncs obsidian's note to kdrive #(pkgs.callPackage ../../modules/scripts/obsidianprofiles.nix {}) # fzf vault selector # obsidian was replaced with a custom solution # no longer used scripts for quickshell. see caelestia-shell diff --git a/modules/packages/README.md b/modules/packages/README.md new file mode 100644 index 0000000..0065938 --- /dev/null +++ b/modules/packages/README.md @@ -0,0 +1,3 @@ +Used for custom package derivation. + +For example, to use a newer package version that is still not in nixpkgs-unstable. diff --git a/modules/packages/vivify.nix b/modules/packages/vivify.nix new file mode 100644 index 0000000..36b01b3 --- /dev/null +++ b/modules/packages/vivify.nix @@ -0,0 +1,88 @@ +{ + lib, + stdenv, + nix-update-script, + fetchYarnDeps, + fetchFromGitHub, + yarnConfigHook, + npmHooks, + nodejs, + zip, + file, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vivify"; + version = "0.14.0"; + + src = fetchFromGitHub { + owner = "jannis-baum"; + repo = "Vivify"; + tag = "v${finalAttrs.version}"; + hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0="; + }; + + yarnOfflineCache = fetchYarnDeps { + yarnLock = "${finalAttrs.src}/yarn.lock"; + hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc="; + }; + + installPhase = '' + runHook preInstall + + yarn install + + substituteInPlace node_modules/.bin/tsc \ + --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + + substituteInPlace node_modules/.bin/webpack \ + --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + + substituteInPlace node_modules/.bin/postject \ + --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + + make VIV_VERSION=${finalAttrs.version} linux + + mkdir -p $out/bin + install -Dm755 ./build/linux/viv $out/bin/viv + install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server + + wrapProgram $out/bin/viv \ + --prefix PATH : ${ + lib.makeBinPath [ + nodejs + file + ] + } + ''; + + nativeBuildInputs = [ + yarnConfigHook + npmHooks.npmInstallHook + zip + + nodejs + file + ]; + + # Stripping 'unneeded symbols' causes vivify-server executable to break + # (segmentation fault) + dontStrip = true; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Live Markdown viewer"; + longDescription = '' + Vivify brings your files to life in the browser! + Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also + serve as a directory browser and let you view code files with syntax highlighting. + ''; + homepage = "https://github.com/jannis-baum/Vivify"; + changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ skohtv ]; + platforms = lib.platforms.linux; + mainProgram = "viv"; + }; +})