This repository has been archived on 2024-02-04. You can view files and clone it, but cannot push or open issues or pull requests.
blog.polynom.me/pkgs/blog.nix

43 lines
1.0 KiB
Nix

{
lib, stdenv
, gnumake, imagemagick
, python3
, shared-assets # For makesite.py
, tailwindWithTypography
}: let
pythonEnv = python3.withPackages (ps: with ps; [markdown pygments]);
in stdenv.mkDerivation {
pname = "blog";
version = "20231507";
src = ../.;
buildInputs = [ shared-assets gnumake imagemagick ];
patchPhase = ''
sed -i Makefile -e "s|python ../shared-assets/makesite.py|${pythonEnv}/bin/python ${shared-assets}/bin/makesite.py|g"
sed -i Makefile -e "s|tar -czf blog.tar.gz _site||g"
'';
buildPhase = ''
make buildnosign
# Generate Tailwind CSS data
${tailwindWithTypography}/bin/tailwindcss --input ./input.css --output _site/assets/css/index.css
'';
installPhase = ''
mkdir -p $out/srv/www/blog
cp -vr _site/* $out/srv/www/blog
'';
doCheck = false;
meta = with lib; {
description = "The blog hosted at https://blog.polynom.me";
homepage = "https://git.polynom.me/polynom.me/blog.polynom.me";
maintainers = [];
license = licenses.gpl3;
};
}