Tidy up nix scripts

This commit is contained in:
stefan burke 2024-11-27 09:41:00 +00:00
parent bea5fe46b4
commit 3518f4a4ab
2 changed files with 30 additions and 11 deletions

View file

@ -25,10 +25,7 @@ pkgs.stdenv.mkDerivation {
src;
nativeBuildInputs = with pkgs; [
env
ruby_3_3
rubyPackages_3_3.ffi
libffi
html-minifier
];
@ -52,7 +49,4 @@ pkgs.stdenv.mkDerivation {
echo "Copying site files..."
cp -r _site/* $out/
'';
dontFixup = true;
dontPatch = true;
}

View file

@ -8,7 +8,7 @@ with (import <nixpkgs> {}); let
};
in
stdenv.mkDerivation {
name = "YourJekyllSite";
name = "chobble-com";
buildInputs = [
env
ruby_3_3
@ -17,10 +17,35 @@ in
];
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"
serve() {
${env}/bin/jekyll serve --watch &
JEKYLL_PID=$!
exec ${env}/bin/jekyll serve --watch
cleanup_serve() {
echo "Cleaning up serve process..."
kill $JEKYLL_PID 2>/dev/null
wait $JEKYLL_PID 2>/dev/null
}
trap cleanup_serve EXIT INT TERM
wait $JEKYLL_PID
cleanup_serve
trap - EXIT INT TERM
}
export -f serve
cleanup() {
echo "Cleaning up..."
rm -rf _site .jekyll-cache .jekyll-metadata
}
trap cleanup EXIT
echo "Development environment ready!"
echo "Run 'serve' to start development server"
'';
}