NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.4k stars 13.62k forks source link

jekyll doesn't seem to work #42116

Closed ben0x539 closed 3 years ago

ben0x539 commented 6 years ago

Issue description

After nix-env -iA nixos.jekyll, the jekyll new my-awesome-site command from the "Get up and running in seconds" blurb on the jekyll site doesn't work.

Steps to reproduce

$ nix-env -iA nixos.jekyll
[...]
$ jekyll new my-awesome-site 
Running bundle install in /home/ben/my-awesome-site... 
  Bundler: /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/spec_set.rb:88:in `block in materialize': Could not find eventmachine-1.2.7 in any of the sources (Bundler::GemNotFound)
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/spec_set.rb:82:in `map!'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/spec_set.rb:82:in `materialize'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/definition.rb:170:in `specs'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/definition.rb:237:in `specs_for'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/definition.rb:226:in `requested_specs'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:108:in `block in definition_method'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:20:in `setup'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler.rb:107:in `setup'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/bundler/setup.rb:20:in `<top (required)>'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
  Bundler: from /nix/store/5bb1kx5zxfrh86zd80pv2qw0zmymq631-ruby-2.4.4/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'

Technical details

primeos commented 6 years ago

@ben0x539 First of all: Thanks for your report :)

I never noticed this because I was only using jekyll serve (that should work, at least if the site doesn't have any special dependencies).

The problem is that jekyll new seems to use bundler to install the dependencies and assumes that bundler is already installed on the system (e.g. via gem install bundler jekyll from the quick-start instructions on the website). But bundler itself isn't a dependency of jekyll, at least it's not in the Gemfile (I'm actually not that familiar with Ruby).

If I run jekyll new my-awesome-site I'm getting the following error message:

Running bundle install in /tmp/my-awesome-site...
jekyll 3.8.3 | Error:  No such file or directory - ruby

I'm actually not sure what to do here because running bundler install doesn't make much sense (IMO) with Nix(OS).

You could use jekyll new --skip-bundle my-awesome-site but if I then run jekyll serve it will result in the following error:

Configuration file: /tmp/my-awesome-site/_config.yml
jekyll 3.8.3 | Error:  The minima theme could not be found.

It would probably make sense to add the default theme as a dependency, but adding all common themes would most likely just result in a lot of unnecessary bloat.

It might make sense to add additional "use flags" like withBundler and withDefaultTheme but the implementation of that might be a bit problematic. Anyway, I'm open for suggestions if you have any ideas :) (If not we can just leave this issue open and I'll try to come up with something when I have more time.)

ben0x539 commented 6 years ago

Yeah, I don't really know my way around either ruby packaging or how to model it in nixpkgs. This is mostly a drive-by bug report as I'm unlikely to be able to invest much time in jekyll for the time being.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
raboof commented 3 years ago

This seems to work now:

$ nix-shell -p jekyll
(...)
$ jekyll new my-awesome-site
Running bundle install in /tmp/asdf/my-awesome-site... 
  Bundler: Skipping "bundle install" as it fails due to the Nix wrapper.
  Bundler: Please enter the new directory and run the following commands to serve the page:
  Bundler: nix-shell -p bundler --run "bundle install --gemfile=Gemfile --path vendor/cache"
  Bundler: nix-shell -p bundler --run "bundle exec jekyll serve"
New jekyll site installed in /tmp/asdf/my-awesome-site. 

So I think this is fixed. Closing, feel free to comment if it still happens for you though.