2024-11-26 23:51:40 +00:00
|
|
|
{ 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; [
|
|
|
|
ruby_3_3
|
2024-12-03 21:31:09 +00:00
|
|
|
minify
|
2024-11-26 23:51:40 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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..."
|
2024-12-03 21:31:09 +00:00
|
|
|
minify --all --recursive --output . _site
|
2024-11-26 23:51:40 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
echo "Creating output directory..."
|
|
|
|
mkdir -p $out
|
|
|
|
|
|
|
|
echo "Copying site files..."
|
|
|
|
cp -r _site/* $out/
|
|
|
|
'';
|
|
|
|
}
|