I'm on NixOS and I want to build locally some GitHub pages.
GitHub seems to indicate that I should create a Gemfile
containing:
gem "github-pages", group: :jekyll_plugins
Following the Nixpkgs manual section on Ruby, I did:
$ cat > Gemfile
source 'https://rubygems.org'
gem "github-pages", group: :jekyll_plugins
$ $(nix-build '<nixpkgs>' -A bundix --no-out-link)/bin/bundix --magic
which resulted in a build failure on Nokogiri:
An error occurred while installing nokogiri (1.8.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.8.1'` succeeds before bundling.
The build failure is the following:
zlib is missing; necessary for building libxml2
I've confirmed that the issue is when building Nokogiri by running:
gem install nokogiri -v '1.8.1'
in various environments (with nix-shell -p zlib
, nix-shell -p zlibStatic
, nix-shell -p zlib libxml2
, nix-shell -p zlib pkgconfig
, etc).
From searching on Google, it seems that Nokogiri is a very common dependency (e.g. Rails depends on it), so I guess most people have overcome the difficulty I'm confronted to. What am I missing?
Short path
If all you really need is to build a github page you just need to enter a shell with nix-shell -p jekyll
and then jekyll build
because now jekyll is packaged as an application
Long path to use when you wish to have jekyll and other gems in the same Gemfile
You can find detailed instructions here: Building a Jekyll Environment with NixOS (even though there is nothing specific to NixOS really)
I think that is an issue with the --magic
flag (or that I didn't get the true usage of it) and that it doesn't use the special configuration some gems have in nixpkgs.
So to avoid that flag you can (full instructions in the post above):
create a bare Gemfile like you did, without the 'group' directive
in a shell with bundler call bundler lock
to obtain the Gemfile.lock
call bundix
with no arguments to obtain the gemset.nix
create a derivation that has in the buildInputs
the bundlerEnv
like explained in the manual.
Bonus points for the default.nix
of the blog because it starts jekyll local server as you type nix-shell