Switch to Nix builds

This commit is contained in:
stefan burke 2024-11-26 23:51:40 +00:00
parent 1af82fef6c
commit d4e8bc4210
11 changed files with 418 additions and 144 deletions

5
.gitignore vendored
View file

@ -1,4 +1,5 @@
.bundle
_site
vendor
.jekyll-cache
_site
result
vendor

View file

@ -1,5 +1,3 @@
source "https://rubygems.org"
gem "jekyll"
gem "webrick", "~> 1.7"
gem 'sass-embedded', '1.80.3'

View file

@ -11,35 +11,10 @@ GEM
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.17.0)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-aarch64-linux-musl)
ffi (1.17.0-arm-linux-gnu)
ffi (1.17.0-arm-linux-musl)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86-linux-musl)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux-musl)
forwardable-extended (2.6.0)
google-protobuf (4.28.3)
bigdecimal
rake (>= 13)
google-protobuf (4.28.3-aarch64-linux)
bigdecimal
rake (>= 13)
google-protobuf (4.28.3-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.28.3-x86-linux)
bigdecimal
rake (>= 13)
google-protobuf (4.28.3-x86_64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.28.3-x86_64-linux)
bigdecimal
rake (>= 13)
http_parser.rb (0.8.0)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
@ -82,88 +57,19 @@ GEM
rexml (3.3.9)
rouge (4.5.1)
safe_yaml (1.0.5)
sass-embedded (1.80.3)
sass-embedded (1.81.0)
google-protobuf (~> 4.28)
rake (>= 13)
sass-embedded (1.80.3-aarch64-linux-android)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-aarch64-linux-gnu)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-aarch64-linux-musl)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-aarch64-mingw-ucrt)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-arm-linux-androideabi)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-arm-linux-gnueabihf)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-arm-linux-musleabihf)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-arm64-darwin)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-riscv64-linux-android)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-riscv64-linux-gnu)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-riscv64-linux-musl)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86-cygwin)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86-linux-android)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86-linux-gnu)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86-linux-musl)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86-mingw-ucrt)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86_64-cygwin)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86_64-darwin)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86_64-linux-android)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86_64-linux-gnu)
google-protobuf (~> 4.28)
sass-embedded (1.80.3-x86_64-linux-musl)
google-protobuf (~> 4.28)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.6.0)
webrick (1.9.0)
PLATFORMS
aarch64-linux
aarch64-linux-android
aarch64-linux-gnu
aarch64-linux-musl
aarch64-mingw-ucrt
arm-linux-androideabi
arm-linux-gnu
arm-linux-gnueabihf
arm-linux-musl
arm-linux-musleabihf
arm64-darwin
riscv64-linux-android
riscv64-linux-gnu
riscv64-linux-musl
ruby
x86-cygwin
x86-linux
x86-linux-android
x86-linux-gnu
x86-linux-musl
x86-mingw-ucrt
x86_64-cygwin
x86_64-darwin
x86_64-linux-android
x86_64-linux-gnu
x86_64-linux-musl
DEPENDENCIES
jekyll
sass-embedded (= 1.80.3)
webrick (~> 1.7)
BUNDLED WITH
2.5.16
2.5.22

View file

@ -16,3 +16,6 @@ exclude:
- node_modules/
- vendor/
- bin/
- shell.nix
- default.nix
- result

View file

@ -1,13 +0,0 @@
#!/usr/bin/env bash
rm -rf _site
nix-shell -p jekyll --pure --command "
echo 'Building site'
jekyll build
"
nix-shell -p html-minifier --pure --command "
echo 'Minifying site'
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
"

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
nix-shell -p neocities-cli --command "
echo 'Pushing to Neocities'
set +x
export NEOCITIES_API_KEY=$(cat ~/.neocities/chobble)
set -x
neocities push --prune _site
"

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bash
rm -rf _site
nix-shell -p ruby_3_3 imagemagick pkg-config --pure --command "
echo 'Installing bundles'
bundle config set path 'vendor/cache'
bundle install --gemfile=Gemfile
echo 'Building site'
bundle exec jekyll serve
"

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
nix-shell -p ruby_3_3 imagemagick pkg-config --pure --command "
export JEKYLL_ENV=production
echo 'Installing bundles'
bundle config set path 'vendor/cache'
bundle install --gemfile=Gemfile
bundle update
"

58
default.nix Normal file
View file

@ -0,0 +1,58 @@
{ pkgs ? import <nixpkgs> {} }:
let
src = ./.;
env = pkgs.bundlerEnv {
name = "chobble-com";
inherit (pkgs) ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in
pkgs.stdenv.mkDerivation {
name = "chobble-com";
src = builtins.filterSource
(path: type: !(builtins.elem (baseNameOf path) [
"_site"
".jekyll-cache"
".git"
"node_modules"
"result"
"vendor"
]))
src;
nativeBuildInputs = with pkgs; [
env
ruby_3_3
rubyPackages_3_3.ffi
libffi
html-minifier
];
configurePhase = ''
export HOME=$TMPDIR
mkdir -p _site
'';
buildPhase = ''
echo "Building site with Jekyll..."
JEKYLL_ENV=production ${env}/bin/jekyll build --source . --destination _site --trace
echo "Minifying HTML..."
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
'';
installPhase = ''
echo "Creating output directory..."
mkdir -p $out
echo "Copying site files..."
cp -r _site/* $out/
'';
dontFixup = true;
dontPatch = true;
}

326
gemset.nix Normal file
View file

@ -0,0 +1,326 @@
{
addressable = {
dependencies = ["public_suffix"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0cl2qpvwiffym62z991ynks7imsm87qmgxf0yfsmlwzkgi9qcaa6";
type = "gem";
};
version = "2.8.7";
};
bigdecimal = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1gi7zqgmqwi5lizggs1jhc3zlwaqayy9rx2ah80sxy24bbnng558";
type = "gem";
};
version = "3.1.8";
};
colorator = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72";
type = "gem";
};
version = "1.1.0";
};
concurrent-ruby = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0chwfdq2a6kbj6xz9l6zrdfnyghnh32si82la1dnpa5h75ir5anl";
type = "gem";
};
version = "1.3.4";
};
em-websocket = {
dependencies = ["eventmachine" "http_parser.rb"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1a66b0kjk6jx7pai9gc7i27zd0a128gy73nmas98gjz6wjyr4spm";
type = "gem";
};
version = "0.5.3";
};
eventmachine = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0wh9aqb0skz80fhfn66lbpr4f86ya2z5rx6gm5xlfhd05bj1ch4r";
type = "gem";
};
version = "1.2.7";
};
ffi = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "07139870npj59jnl8vmk39ja3gdk3fb5z9vc0lf32y2h891hwqsi";
type = "gem";
};
version = "1.17.0";
};
forwardable-extended = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v";
type = "gem";
};
version = "2.6.0";
};
google-protobuf = {
dependencies = ["bigdecimal" "rake"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1d99vyhmyp2n5zd0qmfymzwbcn71dbnwwvc0m4z14msjb7b8dvf0";
type = "gem";
};
version = "4.28.3";
};
"http_parser.rb" = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1gj4fmls0mf52dlr928gaq0c0cb0m3aqa9kaa6l0ikl2zbqk42as";
type = "gem";
};
version = "0.8.0";
};
i18n = {
dependencies = ["concurrent-ruby"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0k31wcgnvcvd14snz0pfqj976zv6drfsnq6x8acz10fiyms9l8nw";
type = "gem";
};
version = "1.14.6";
};
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"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0124fnqizh7njn99qg4f3jvf9kg2rpm88drs9p9r5hqr50n2i264";
type = "gem";
};
version = "4.3.4";
};
jekyll-sass-converter = {
dependencies = ["sass-embedded"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "00n9v19h0qgjijygfdkdh2gwpmdlz49nw1mqk6fnp43f317ngrz2";
type = "gem";
};
version = "3.0.0";
};
jekyll-watch = {
dependencies = ["listen"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1qd7hy1kl87fl7l0frw5qbn22x7ayfzlv9a5ca1m59g0ym1ysi5w";
type = "gem";
};
version = "2.2.1";
};
kramdown = {
dependencies = ["rexml"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "131nwypz8b4pq1hxs6gsz3k00i9b75y3cgpkq57vxknkv6mvdfw7";
type = "gem";
};
version = "2.5.1";
};
kramdown-parser-gfm = {
dependencies = ["kramdown"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv";
type = "gem";
};
version = "1.1.0";
};
liquid = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1czxv2i1gv3k7hxnrgfjb0z8khz74l4pmfwd70c7kr25l2qypksg";
type = "gem";
};
version = "4.0.4";
};
listen = {
dependencies = ["rb-fsevent" "rb-inotify"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0rwwsmvq79qwzl6324yc53py02kbrcww35si720490z5w0j497nv";
type = "gem";
};
version = "3.9.0";
};
mercenary = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0f2i827w4lmsizrxixsrv2ssa3gk1b7lmqh8brk8ijmdb551wnmj";
type = "gem";
};
version = "0.4.0";
};
pathutil = {
dependencies = ["forwardable-extended"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "12fm93ljw9fbxmv2krki5k5wkvr7560qy8p4spvb9jiiaqv78fz4";
type = "gem";
};
version = "0.16.2";
};
public_suffix = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0vqcw3iwby3yc6avs1vb3gfd0vcp2v7q310665dvxfswmcf4xm31";
type = "gem";
};
version = "6.0.1";
};
rake = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6";
type = "gem";
};
version = "13.2.1";
};
rb-fsevent = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1zmf31rnpm8553lqwibvv3kkx0v7majm1f341xbxc0bk5sbhp423";
type = "gem";
};
version = "0.11.2";
};
rb-inotify = {
dependencies = ["ffi"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0vmy8xgahixcz6hzwy4zdcyn2y6d6ri8dqv5xccgzc1r292019x0";
type = "gem";
};
version = "0.11.1";
};
rexml = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1j9p66pmfgxnzp76ksssyfyqqrg7281dyi3xyknl3wwraaw7a66p";
type = "gem";
};
version = "3.3.9";
};
rouge = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1pchwrkr0994v7mh054lcp0na3bk3mj2sk0dc33bn6bhxrnirj1a";
type = "gem";
};
version = "4.5.1";
};
safe_yaml = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0j7qv63p0vqcd838i2iy2f76c3dgwzkiz1d1xkg7n0pbnxj2vb56";
type = "gem";
};
version = "1.0.5";
};
sass-embedded = {
dependencies = ["google-protobuf" "rake"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1dr6kkfch4p2c5414r21ijzxnrs3iid8x0ywzclqxznq0vqlgpax";
type = "gem";
};
version = "1.81.0";
};
terminal-table = {
dependencies = ["unicode-display_width"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "14dfmfjppmng5hwj7c5ka6qdapawm3h6k9lhn8zj001ybypvclgr";
type = "gem";
};
version = "3.0.2";
};
unicode-display_width = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0nkz7fadlrdbkf37m0x7sw8bnz8r355q3vwcfb9f9md6pds9h9qj";
type = "gem";
};
version = "2.6.0";
};
webrick = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0r79mir4phdmcx0l4yqfwfzdy8vgvrl4ym07585rd2b401bhrrcy";
type = "gem";
};
version = "1.9.0";
};
}

26
shell.nix Normal file
View file

@ -0,0 +1,26 @@
with (import <nixpkgs> {}); let
env = bundlerEnv {
name = "YourJekyllSite";
inherit ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in
stdenv.mkDerivation {
name = "YourJekyllSite";
buildInputs = [
env
ruby_3_3
rubyPackages_3_3.ffi
libffi
];
shellHook = ''
export PKG_CONFIG_PATH="${pkgs.libffi}/lib/pkgconfig:$PKG_CONFIG_PATH"
export LIBFFI_CFLAGS="-I${pkgs.libffi}/include"
export LIBFFI_LIBS="-L${pkgs.libffi}/lib -lffi"
exec ${env}/bin/jekyll serve --watch
'';
}