Jekyll on Nixos

6 minute read

Published:

Back when I used to help my Fachschaft with their website 1 , I would be able to run things locally to see how my blog worked before publishing it the main branch. This is supposedly following good coding practices, as oppsing to yoloing it everytime and modifying the main branch.

Back then, I could just do a nix shell and add jekyll and bundler, and then do bundle exec jekyll serve and it would work.

Unfortuantely, becuase I use nixos, life is hard. And by life is hard, I mean that doesn’t work anymore.

I run it and…

Could not find jekyll-3.10.0, jekyll-feed-0.17.0, jekyll-sitemap-1.4.0, jekyll-redirect-from-0.16.0, jemoji-0.13.0, webrick-1.9.2, github-pages-232, connection_pool-2.5.0, addressable-2.8.9, colorator-1.1.0, csv-3.3.5, em-websocket-0.5.3, i18n-1.14.8, jekyll-sass-converter-1.5.2, jekyll-watch-2.2.1, kramdown-2.4.0, liquid-4.0.4, mercenary-0.3.6, pathutil-0.16.2, rouge-3.30.0, safe_yaml-1.0.5, gemoji-4.1.0, html-pipeline-2.14.3, github-pages-health-check-1.18.2, jekyll-avatar-0.8.0, jekyll-coffeescript-1.2.2, jekyll-commonmark-ghpages-0.5.1, jekyll-default-layout-0.1.5, jekyll-gist-1.5.0, jekyll-github-metadata-2.16.1, jekyll-include-cache-0.2.1, jekyll-mentions-1.6.0, jekyll-optional-front-matter-0.3.2, jekyll-paginate-1.1.0, jekyll-readme-index-0.3.0, jekyll-relative-links-0.6.1, jekyll-remote-theme-0.4.3, jekyll-seo-tag-2.8.0, jekyll-swiss-1.0.0, jekyll-theme-architect-0.2.0, jekyll-theme-cayman-0.2.0, jekyll-theme-dinky-0.2.0, jekyll-theme-hacker-0.2.0, jekyll-theme-leap-day-0.2.0, jekyll-theme-merlot-0.2.0, jekyll-theme-midnight-0.2.0, jekyll-theme-minimal-0.2.0, jekyll-theme-modernist-0.2.0, jekyll-theme-primer-0.6.0, jekyll-theme-slate-0.2.0, jekyll-theme-tactile-0.2.0, jekyll-theme-time-machine-0.2.0, jekyll-titles-from-headings-0.5.3, kramdown-parser-gfm-1.1.0, minima-2.5.1, nokogiri-1.19.2-x86_64-linux-gnu, terminal-table-1.8.0, public_suffix-5.1.1, eventmachine-1.2.7, http_parser.rb-0.8.1, concurrent-ruby-1.3.6, sass-3.7.4, listen-3.10.0, rexml-3.4.4, forwardable-extended-2.6.0, activesupport-8.1.3, dnsruby-1.73.1, octokit-4.25.1, typhoeus-1.6.0, coffee-script-2.4.1, coffee-script-source-1.12.2, commonmarker-0.23.12, jekyll-commonmark-1.4.0, rubyzip-2.4.1, racc-1.8.1, unicode-display_width-1.8.0, sass-listen-4.0.0, logger-1.7.0, rb-fsevent-0.11.2, rb-inotify-0.11.1, base64-0.3.0, bigdecimal-4.0.1, drb-2.2.3, json-2.19.3, minitest-6.0.2, tzinfo-2.0.6, uri-1.1.1, simpleidn-0.2.3, faraday-2.14.1, sawyer-0.9.3, ethon-0.18.0, execjs-2.10.0, ffi-1.17.3-x86_64-linux-gnu, prism-1.9.0, faraday-net_http-3.4.2, net-http-0.9.1 in locally installed gems
Run `/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/exe/bundle install` to install missing gems.

Ok, cool. I guess I’ll run bundle install. Even though I’m pretty sure it’s not the “nix way”. Whatever, let’s give it a shot:

Bundler 2.7.2 is running, but your lockfile was generated with 2.4.19. Installing Bundler 2.4.19 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.4.19
Installing bundler 2.4.19
Fetching gem metadata from https://rubygems.org/.........
Fetching base64 0.3.0
Fetching bigdecimal 4.0.1
Fetching concurrent-ruby 1.3.6
Fetching connection_pool 2.5.0
Installing base64 0.3.0
Fetching drb 2.2.3
Installing bigdecimal 4.0.1 with native extensions
Fetching json 2.19.3
Installing connection_pool 2.5.0
Fetching logger 1.7.0
Installing concurrent-ruby 1.3.6
Installing drb 2.2.3
Fetching prism 1.9.0
Installing json 2.19.3 with native extensions
Installing logger 1.7.0
Fetching securerandom 0.4.1
Fetching uri 1.1.1
Installing securerandom 0.4.1
Fetching public_suffix 5.1.1
Fetching coffee-script-source 1.12.2
Installing uri 1.1.1
Fetching execjs 2.10.0
Installing public_suffix 5.1.1
Installing execjs 2.10.0
Installing coffee-script-source 1.12.2
Installing prism 1.9.0 with native extensions
Fetching colorator 1.1.0
Fetching commonmarker 0.23.12
Installing colorator 1.1.0
Fetching csv 3.3.5
Fetching simpleidn 0.2.3
Installing commonmarker 0.23.12 with native extensions
Installing csv 3.3.5
Installing simpleidn 0.2.3
Fetching eventmachine 1.2.7
Fetching http_parser.rb 0.8.1
Installing eventmachine 1.2.7 with native extensions
Installing http_parser.rb 0.8.1 with native extensions
Fetching ffi 1.17.3 (x86_64-linux-gnu)
Fetching forwardable-extended 2.6.0
Installing forwardable-extended 2.6.0
Installing ffi 1.17.3 (x86_64-linux-gnu)
Fetching gemoji 4.1.0
Installing gemoji 4.1.0
Fetching rb-fsevent 0.11.2
Fetching rexml 3.4.4
Fetching liquid 4.0.4
Fetching mercenary 0.3.6
Installing rb-fsevent 0.11.2
Fetching rouge 3.30.0
Installing rexml 3.4.4
Fetching safe_yaml 1.0.5
Installing liquid 4.0.4
Installing mercenary 0.3.6
Fetching webrick 1.9.2
Fetching racc 1.8.1
Installing safe_yaml 1.0.5
Installing webrick 1.9.2
Installing racc 1.8.1 with native extensions
Installing rouge 3.30.0
Fetching jekyll-paginate 1.1.0
Installing jekyll-paginate 1.1.0
Fetching rubyzip 2.4.1
Fetching jekyll-swiss 1.0.0
Installing rubyzip 2.4.1
Installing jekyll-swiss 1.0.0
Fetching unicode-display_width 1.8.0
Installing unicode-display_width 1.8.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/john/jzw2.github.io/vendor/cache/ruby/3.4.0/gems/bigdecimal-4.0.1/ext/bigdecimal
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/bin/ruby extconf.rb
checking for __builtin_clz()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include=${opt-dir}/include
	--without-opt-include
	--with-opt-lib=${opt-dir}/lib
	--without-opt-lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/bin/$(RUBY_BASE_NAME)
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:528:in
'MakeMakefile#try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.

from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:655:in
'MakeMakefile#try_compile'
	from extconf.rb:6:in 'block in Object#have_builtin_func'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:1070:in
'block in MakeMakefile#checking_for'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:370:in
'block (2 levels) in MakeMakefile::Logging.postpone'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:340:in
'MakeMakefile::Logging.open'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:370:in
'block in MakeMakefile::Logging.postpone'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:340:in
'MakeMakefile::Logging.open'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:366:in
'MakeMakefile::Logging.postpone'
from
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/mkmf.rb:1069:in
'MakeMakefile#checking_for'
	from extconf.rb:5:in 'Object#have_builtin_func'
	from extconf.rb:18:in '<main>'

To see why this extension failed to compile, please check the mkmf.log which can be
found here:

/home/john/jzw2.github.io/vendor/cache/ruby/3.4.0/extensions/x86_64-linux/3.4.0/bigdecimal-4.0.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/john/jzw2.github.io/vendor/cache/ruby/3.4.0/gems/bigdecimal-4.0.1 for inspection.
Results logged to
/home/john/jzw2.github.io/vendor/cache/ruby/3.4.0/extensions/x86_64-linux/3.4.0/bigdecimal-4.0.1/gem_make.out

/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/ext/builder.rb:125:in
'Gem::Ext::Builder.run'
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/ext/ext_conf_builder.rb:30:in
'Gem::Ext::ExtConfBuilder.build'
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/ext/builder.rb:206:in
'Gem::Ext::Builder#build_extension'
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/ext/builder.rb:240:in
'block in Gem::Ext::Builder#build_extensions'
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/ext/builder.rb:237:in
'Array#each'
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/ext/builder.rb:237:in
'Gem::Ext::Builder#build_extensions'
/nix/store/lkrkc1fxj9yr3ghsxp7nq30c2hxn9z0k-ruby-3.4.9/lib/ruby/3.4.0/rubygems/installer.rb:842:in
'Gem::Installer#build_extensions'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/rubygems_gem_installer.rb:111:in
'Bundler::RubyGemsGemInstaller#build_extensions'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/rubygems_gem_installer.rb:30:in
'Bundler::RubyGemsGemInstaller#install'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/source/rubygems.rb:220:in
'Bundler::Source::Rubygems#install'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/installer/gem_installer.rb:55:in
'Bundler::GemInstaller#install'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/installer/gem_installer.rb:17:in
'Bundler::GemInstaller#install_from_spec'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/installer/parallel_installer.rb:133:in
'Bundler::ParallelInstaller#do_install'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/installer/parallel_installer.rb:124:in
'block in Bundler::ParallelInstaller#worker_pool'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/worker.rb:62:in
'Bundler::Worker#apply_func'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/worker.rb:57:in
'block in Bundler::Worker#process_queue'
  <internal:kernel>:168:in 'Kernel#loop'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/worker.rb:54:in
'Bundler::Worker#process_queue'
/nix/store/h1mbxa2abvyhzwkvp6vdbm346k3spbda-bundler-2.7.2/lib/ruby/gems/3.4.0/gems/bundler-2.7.2/lib/bundler/worker.rb:90:in
'block (2 levels) in Bundler::Worker#create_threads'

An error occurred while installing bigdecimal (4.0.1), and Bundler cannot
continue.

In Gemfile:
  github-pages was resolved to 232, which depends on
    jekyll-mentions was resolved to 1.6.0, which depends on
      html-pipeline was resolved to 2.14.3, which depends on
        activesupport was resolved to 8.1.3, which depends on
          bigdecimal

Oof, looks like it din’t work.

What’s really stupid, is that I think I figured out how to run it back in March/April. Unfortunately, I did not write down how I did it. And when I just made my blog post, I could not figure out how to test it.

Ok, time to do some detective work and retrace my steps. Looking at my browser history, I see I visited this guy, and looks like there is this guy working for deltachat.

And would you look at that, I had already shamelessly copy pasted his flake.nix. I didn’t even change it from deltachat lol.

And it also didn’t work.

Finally, looked at the source for jekyll. And this helpful part here gave me a hint

echo 'Skipping "bundle install" as it fails due to the Nix wrapper.'
echo 'Please enter the new directory and run the following commands to serve the page:'
echo 'nix-shell -p bundler --run "bundle install --gemfile=Gemfile --path vendor/cache"'
echo 'nix-shell -p bundler --run "bundle exec jekyll serve"'
exit 0

Well, that seemed to solve the issue. I don’t know why the flake.nix. Maybe someone smarter than me can tell me why.

  1. Looks like I’m still the biggest contributer., I bit ironic since I stopped two and a half years ago.