From c9adce3aad183ad037a8587bcb13cbeb10252a8c Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 7 Apr 2020 20:54:36 -0700 Subject: [PATCH] Fix previous commit; add missing files. --- blog/convert.rb | 4 ++-- blog/default.nix | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/blog/convert.rb b/blog/convert.rb index 86461ea..86d660b 100644 --- a/blog/convert.rb +++ b/blog/convert.rb @@ -4,7 +4,7 @@ require "nokogiri" def perform_katex_sub(content) rendered = content.gsub /\\\(((?:[^\\]|\\[^\)])*)\\\)/ do |match| puts " Rendering #{$~[1]}" - Open3.popen3("$(npm bin)/katex") do |i, o, e, t| + Open3.popen3("katex") do |i, o, e, t| i.write $~[1] i.close o.read.force_encoding(Encoding::UTF_8).strip @@ -12,7 +12,7 @@ def perform_katex_sub(content) end rendered = rendered.gsub /\$\$((?:[^\$]|$[^\$])*)\$\$/ do |match| puts " Rendering display." - Open3.popen3("$(npm bin)/katex -d") do |i, o, e, t| + Open3.popen3("katex -d") do |i, o, e, t| i.write $~[1] i.close o.read.force_encoding(Encoding::UTF_8).strip diff --git a/blog/default.nix b/blog/default.nix index 6b88dc6..2a0c431 100644 --- a/blog/default.nix +++ b/blog/default.nix @@ -1,9 +1,10 @@ -{ stdenv, hugo, fetchgit, katex, ruby }: +{ stdenv, hugo, fetchgit, pkgs, nodejs, ruby }: let url = "https://dev.danilafe.com/Web-Projects/blog-static.git"; rev = "7f3883fb3994f8ae1a64446a88b729662c9244dc"; sha256 = "065by3rjg7a43dqdl5ib07c0xi86balb5x2l54jqnlh1hz00bd85"; + requiredPackages = import ./required-packages.nix { inherit pkgs nodejs; }; in stdenv.mkDerivation { name = "blog-static"; @@ -13,5 +14,5 @@ in }; builder = ./builder.sh; converter = ./convert.rb; - buildInputs = [ hugo katex (ruby.withPackages (ps: [ ps.nokogiri ])) ]; + buildInputs = [ hugo requiredPackages.katex (ruby.withPackages (ps: [ ps.nokogiri ])) ]; }