Jekyll


Jekyll is a simple, blog-aware, static site generator for personal, project, or organization sites. Written in Ruby by Tom Preston-Werner, GitHub's co-founder, it is distributed under the open source MIT license.

Wikipedia


Installation

Default

guix package -i jekyll

On-Demand environment

guix package --profile=jekyll --install ruby@2.4.3 jekyll@2.8.3 ruby-jekyll-watch@2.0.0

The environment will be stored at ~/jekyll.

guix package --search-paths --profile=jekyll

To add more packages to a profile, do:

$ guix package --profile=jekyll -i package-name

**Note: You should run this, in the folder that contains your existing jekyll profile. Otherwise, a new profile will be created.

Reproducible environment

Create a new file

$ nano jekyll-website.scm

with the following content:

(use-modules (guix packages)
             (guix licenses)
             (guix build-system ruby)
             (gnu packages)
             (gnu packages version-control)
             (gnu packages ssh)
             (gnu packages ruby))

(package
  (name "jekyll-project")
  (version "1.0")
  (source #f) ; not needed just to create dev environment
  (build-system ruby-build-system)
  ;; These correspond roughly to "development" dependencies.
  (native-inputs
   `(("git" ,git)
     ("openssh" ,openssh)
     ("ruby-rspec" ,ruby-rspec)))
  (propagated-inputs
   `(("jekyll" ,jekyll)))
  (synopsis "A jekyll website")
  (description "This is a jekyll example website")
  (home-page "https://example.com")
  (license expat))

To initiate the new project environment, run:

$ guix environment -l jekyll-website.scm

You're now 'in' the environment, indicated with a [env] in your console.

Normally, we would initiate a new jekyll site using jekyll new my-site but that would result in the use of bundler, which we won't need, as long as we're working with guix.

We've prepared a repository, which contains the result of the command.

git clone https://git.pantherx.org/published/jekyll-new-site.git
cd jekyll-new-site

Now run jekyll as usual:

jekyll serve

Jekyll with bundler

Create a new file

$ nano jekyll-website.scm

with the following content:

(use-modules (guix packages)
             (guix licenses)
             (guix build-system ruby)
             (gnu packages)
             (gnu packages version-control)
             (gnu packages ssh)
             (gnu packages ruby))

(package
  (name "jekyll-project")
  (version "1.0")
  (source #f) ; not needed just to create dev environment
  (build-system ruby-build-system)
  ;; These correspond roughly to "development" dependencies.
  (native-inputs
   `(("git" ,git)
     ("openssh" ,openssh)
     ("ruby-rspec" ,ruby-rspec)))
  (propagated-inputs
   `(("bundler" ,bundler)))
  (synopsis "A jekyll website")
  (description "This is a jekyll example website")
  (home-page "https://example.com")
  (license expat))

To initiate the new project environment, run:

$ guix environment -l jekyll-website.scm

Create a new folder, and initialize bundler:

$ mkdir my-site && cd my-site
$ bundle init

Set bundler to use vendor/bundle for gem files:

$ bundle install --path vendor/bundle

Add add jekyll:

$ bundle add jekyll

Now you can create the scaffolding site using:

$ bundle exec jekyll new --force --skip-bundle .
$ bundle install

To run jekyll:

$ bundle exec jekyll serve

Troubleshooting

Errno::EACCES: Permission denied @ rb_sysopen - ~/my-site/Gemfile

Check file permissions with:

$ ls -la ~/my-site/

and add read and write permissions as necessary:

$ chmod +rw ~/my-site/Gemfile

See also

PantherX & (unofficial) GuixSD Wiki.

Last update: 2020-02-19 21:18:01 +0000

Inspired by the excellent Arch Linux Wiki