_: {
  perSystem = {
    pkgs,
    nodejs,
    ...
  }: {
    packages.vivifyManuallyDerived = pkgs.stdenv.mkDerivation (finalAttrs: {
      pname = "vivify";
      version = "0.14.0";

      src = pkgs.fetchFromGitHub {
        owner = "jannis-baum";
        repo = "Vivify";
        tag = "v${finalAttrs.version}";
        hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0=";
      };

      yarnOfflineCache = pkgs.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' '${pkgs.lib.getExe nodejs}'

        substituteInPlace node_modules/.bin/webpack \
          --replace-fail '/usr/bin/env node' '${pkgs.lib.getExe nodejs}'

        substituteInPlace node_modules/.bin/postject \
          --replace-fail '/usr/bin/env node' '${pkgs.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 : ${
          pkgs.lib.makeBinPath [
            pkgs.nodejs
            pkgs.file
          ]
        }
      '';

      nativeBuildInputs = with pkgs; [
        yarnConfigHook
        npmHooks.npmInstallHook
        zip

        nodejs
        file
      ];

      # Stripping 'unneeded symbols' causes vivify-server executable to break
      # (segmentation fault)
      dontStrip = true;

      passthru.updateScript = pkgs.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 = pkgs.lib.licenses.gpl3;
        maintainers = with pkgs.lib.maintainers; [skohtv];
        platforms = pkgs.lib.platforms.linux;
        mainProgram = "viv";
      };
    });
  };
}
