freehold-cottage/default.nix

53 lines
995 B
Nix
Raw Normal View History

2024-12-05 17:11:17 +00:00
{ pkgs ? import <nixpkgs> {} }:
let
src = ./.;
env = pkgs.bundlerEnv {
2024-12-05 17:25:16 +00:00
name = "freeholdcottage-com";
2024-12-05 17:11:17 +00:00
inherit (pkgs) ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in
pkgs.stdenv.mkDerivation {
2024-12-05 17:25:16 +00:00
name = "freeholdcottage-com";
2024-12-05 17:11:17 +00:00
src = builtins.filterSource
(path: type: !(builtins.elem (baseNameOf path) [
"_site"
".jekyll-cache"
".git"
"node_modules"
"result"
"vendor"
]))
src;
nativeBuildInputs = with pkgs; [
ruby_3_3
minify
];
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'
minify --all --recursive --output . _site
'';
installPhase = ''
echo "Creating output directory..."
mkdir -p $out
echo "Copying site files..."
cp -r _site/* $out/
'';
}