Add a jekyll spec.

pull/1/head
Joshua Potter 2023-12-17 06:37:22 -07:00
parent 0aaa1ebc38
commit bcac1f118b
10 changed files with 674 additions and 0 deletions

64
specs/jekyll/runner Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
# Exit immediately if the script encounters a non-zero status.
set -e
# If set, Bash includes filenames beginning with a `.` in the results of
# filename expansion. The filenames `.` and `..` must always be matched
# explicitly, even if dotglob is set.
shopt -s dotglob extglob
# ============================================================
# PROLOGUE
# ============================================================
# Create a new top-level directory as fallback in case $BUILD (defined below)
# is ever empty.
mkdir -p "/tmp/bs.jekyll"
# Create an intermediate build directory. The final step of this script will
# copy the content from this directory to $OUT.
BUILD=$(mktemp -d -p "/tmp/bs.jekyll")
if [ -z "$BUILD" ]; then
>&2 echo "Failed to create temp directory."
exit 1
fi
# Deletes the intermediate build directory on exit. We use a concatenation of
# the intermediate directory with the basename of the generated temp directory
# to ensure we never evaluate to root (i.e. `/`). That should never actually
# happen but a good habit to establish nonetheless.
function cleanup {
rm -r "/tmp/bs.jekyll/$(basename "$BUILD")"
}
trap cleanup EXIT
# ============================================================
# BUILD
# ============================================================
# Copy template contents over to the intermediate build directory.
cp -r template/* "$BUILD"
# Explicitly set permissions on all copied files.
find "$BUILD" -type f -execdir chmod 644 {} +
# Replace the placeholder name found in the template files.
sed -i "s/<NAME>/$NAME/g" "$BUILD/flake.nix"
# Generate a new project with the specified name.
nix develop "$BUILD" --command bash -c "jekyll new $BUILD/$NAME"
# Copy over the generated contents.
mv "$BUILD/$NAME"/!(Gemfile) "$BUILD"
rm "$BUILD/$NAME"/Gemfile
rmdir "$BUILD/$NAME"
# ============================================================
# EPILOGUE
# ============================================================
# Success! Copy contents to target directory.
cp -a "$BUILD"/* "$OUT"

7
specs/jekyll/spec.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": {
"type": "line",
"prompt": "Name> "
}
}

View File

@ -0,0 +1,2 @@
---
BUNDLE_FORCE_RUBY_PLATFORM: "true"

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
use flake

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
source "https://rubygems.org"
gem "jekyll", "~> 4.3.2"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
end

View File

@ -0,0 +1,82 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.2.2)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.16.3)
forwardable-extended (2.6.0)
google-protobuf (3.25.1)
http_parser.rb (0.8.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (4.3.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-feed (0.17.0)
jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.4)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.6)
rouge (4.2.0)
safe_yaml (1.0.5)
sass-embedded (1.69.5)
google-protobuf (~> 3.23)
rake (>= 13.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.5.0)
webrick (1.8.1)
PLATFORMS
ruby
DEPENDENCIES
jekyll (~> 4.3.2)
jekyll-feed (~> 0.12)
minima (~> 2.5)
BUNDLED WITH
2.4.22

View File

@ -0,0 +1,29 @@
# Jekyll Flake Template
This is a template for bootstrapping a [Jekyll](https://jekyllrb.com/)-based
project (version 4.3.2) with the [minima](https://github.com/jekyll/minima)
theme (version 2.5.1). [direnv](https://direnv.net/) can be used to launch a
dev shell upon entering this directory (refer to `.envrc`). Otherwise run via:
```bash
$ nix develop
```
Start the server by running:
```
$ jekyll serve [--watch]
```
## Building
Dependencies are managed using [bundix](https://github.com/nix-community/bundix).
If you make any changes to the `Gemfile`, run the following:
```bash
$ bundix -l
```
This will update the `Gemfile.lock` and `gemset.nix` files. Afterward you can
run:
```bash
$ nix build
```
Note that we need the `.bundle/config` file to workaround issues bundix has with
pre-built, platform-specific gems. Refer to
[PR #68](https://github.com/nix-community/bundix/pull/68) for more details.

View File

@ -0,0 +1,76 @@
{
"nodes": {
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1702312524,
"narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a9bf124c46ef298113270b1f84a164865987a91c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,50 @@
{
description = ''
An opinionated jekyll flake.
To generate a copy of this template elsewhere, install
[bootstrap](https://github.com/jrpotter/bootstrap) and run:
```bash
$ bootstrap jekyll
```
'';
inputs = {
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gems = pkgs.bundlerEnv {
name = "<NAME>-gems";
gemdir = ./.;
ruby = pkgs.ruby_3_2;
};
in
{
packages = {
app = pkgs.stdenv.mkDerivation {
name = "<NAME>";
buildInputs = [ gems gems.wrappedRuby ];
src = ./.;
version = "0.1.0";
installPhase = "jekyll b -d $out";
};
default = self.packages.${system}.app;
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bundix
gems
gems.wrappedRuby
];
};
}
);
}

View File

@ -0,0 +1,348 @@
{
addressable = {
dependencies = ["public_suffix"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0irbdwkkjwzajq1ip6ba46q49sxnrl2cw7ddkdhsfhb6aprnm3vr";
type = "gem";
};
version = "2.8.6";
};
colorator = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72";
type = "gem";
};
version = "1.1.0";
};
concurrent-ruby = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0krcwb6mn0iklajwngwsg850nk8k9b35dhmc2qkbdqvmifdi2y9q";
type = "gem";
};
version = "1.2.2";
};
em-websocket = {
dependencies = ["eventmachine" "http_parser.rb"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1a66b0kjk6jx7pai9gc7i27zd0a128gy73nmas98gjz6wjyr4spm";
type = "gem";
};
version = "0.5.3";
};
eventmachine = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0wh9aqb0skz80fhfn66lbpr4f86ya2z5rx6gm5xlfhd05bj1ch4r";
type = "gem";
};
version = "1.2.7";
};
ffi = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1yvii03hcgqj30maavddqamqy50h7y6xcn2wcyq72wn823zl4ckd";
type = "gem";
};
version = "1.16.3";
};
forwardable-extended = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v";
type = "gem";
};
version = "2.6.0";
};
google-protobuf = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "18yiqq657lbqbrbdfbxfspdrkiynd0wf49l3cgdw939z36cy0h77";
type = "gem";
};
version = "3.25.1";
};
"http_parser.rb" = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1gj4fmls0mf52dlr928gaq0c0cb0m3aqa9kaa6l0ikl2zbqk42as";
type = "gem";
};
version = "0.8.0";
};
i18n = {
dependencies = ["concurrent-ruby"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0qaamqsh5f3szhcakkak8ikxlzxqnv49n2p7504hcz2l0f4nj0wx";
type = "gem";
};
version = "1.14.1";
};
jekyll = {
dependencies = ["addressable" "colorator" "em-websocket" "i18n" "jekyll-sass-converter" "jekyll-watch" "kramdown" "kramdown-parser-gfm" "liquid" "mercenary" "pathutil" "rouge" "safe_yaml" "terminal-table" "webrick"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0wbp9xjnjv832ksqs816napy6amp5fh8v4wbrxlpxvgakqz6scsx";
type = "gem";
};
version = "4.3.2";
};
jekyll-feed = {
dependencies = ["jekyll"];
groups = ["jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1hzwmjrxi57x68i7jx5rxi8qlcbqcbg3di55wywrp53pr0bap6k8";
type = "gem";
};
version = "0.17.0";
};
jekyll-sass-converter = {
dependencies = ["sass-embedded"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "00n9v19h0qgjijygfdkdh2gwpmdlz49nw1mqk6fnp43f317ngrz2";
type = "gem";
};
version = "3.0.0";
};
jekyll-seo-tag = {
dependencies = ["jekyll"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0638mqhqynghnlnaz0xi1kvnv53wkggaq94flfzlxwandn8x2biz";
type = "gem";
};
version = "2.8.0";
};
jekyll-watch = {
dependencies = ["listen"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1qd7hy1kl87fl7l0frw5qbn22x7ayfzlv9a5ca1m59g0ym1ysi5w";
type = "gem";
};
version = "2.2.1";
};
kramdown = {
dependencies = ["rexml"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1ic14hdcqxn821dvzki99zhmcy130yhv5fqfffkcf87asv5mnbmn";
type = "gem";
};
version = "2.4.0";
};
kramdown-parser-gfm = {
dependencies = ["kramdown"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv";
type = "gem";
};
version = "1.1.0";
};
liquid = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1czxv2i1gv3k7hxnrgfjb0z8khz74l4pmfwd70c7kr25l2qypksg";
type = "gem";
};
version = "4.0.4";
};
listen = {
dependencies = ["rb-fsevent" "rb-inotify"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "13rgkfar8pp31z1aamxf5y7cfq88wv6rxxcwy7cmm177qq508ycn";
type = "gem";
};
version = "3.8.0";
};
mercenary = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f2i827w4lmsizrxixsrv2ssa3gk1b7lmqh8brk8ijmdb551wnmj";
type = "gem";
};
version = "0.4.0";
};
minima = {
dependencies = ["jekyll" "jekyll-feed" "jekyll-seo-tag"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1gk7jmriiswda1ykjzpsw9cpiya4m9n0yrh0h6xnrc8zcfy543jj";
type = "gem";
};
version = "2.5.1";
};
pathutil = {
dependencies = ["forwardable-extended"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "12fm93ljw9fbxmv2krki5k5wkvr7560qy8p4spvb9jiiaqv78fz4";
type = "gem";
};
version = "0.16.2";
};
public_suffix = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1bni4qjrsh2q49pnmmd6if4iv3ak36bd2cckrs6npl111n769k9m";
type = "gem";
};
version = "5.0.4";
};
rake = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1ilr853hawi09626axx0mps4rkkmxcs54mapz9jnqvpnlwd3wsmy";
type = "gem";
};
version = "13.1.0";
};
rb-fsevent = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1zmf31rnpm8553lqwibvv3kkx0v7majm1f341xbxc0bk5sbhp423";
type = "gem";
};
version = "0.11.2";
};
rb-inotify = {
dependencies = ["ffi"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1jm76h8f8hji38z3ggf4bzi8vps6p7sagxn3ab57qc0xyga64005";
type = "gem";
};
version = "0.10.1";
};
rexml = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "05i8518ay14kjbma550mv0jm8a6di8yp5phzrd8rj44z9qnrlrp0";
type = "gem";
};
version = "3.2.6";
};
rouge = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1fkfa0iq3r9b0zzrxpxha17avmyzci3kidzmfbf6fd1279mndpb0";
type = "gem";
};
version = "4.2.0";
};
safe_yaml = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0j7qv63p0vqcd838i2iy2f76c3dgwzkiz1d1xkg7n0pbnxj2vb56";
type = "gem";
};
version = "1.0.5";
};
sass-embedded = {
dependencies = ["google-protobuf" "rake"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "10f04wvgca22lynvy4pycabkf55p4jf3a3bhmmscjmxv89g9khpg";
type = "gem";
};
version = "1.69.5";
};
terminal-table = {
dependencies = ["unicode-display_width"];
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "14dfmfjppmng5hwj7c5ka6qdapawm3h6k9lhn8zj001ybypvclgr";
type = "gem";
};
version = "3.0.2";
};
unicode-display_width = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1d0azx233nags5jx3fqyr23qa2rhgzbhv8pxp46dgbg1mpf82xky";
type = "gem";
};
version = "2.5.0";
};
webrick = {
groups = ["default" "jekyll_plugins"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "13qm7s0gr2pmfcl7dxrmq38asaza4w0i2n9my4yzs499j731wh8r";
type = "gem";
};
version = "1.8.1";
};
}