52 lines
999 B
Nix
52 lines
999 B
Nix
with (import <nixpkgs> {}); let
|
|
env = bundlerEnv {
|
|
name = "FreeholdCottage";
|
|
inherit ruby;
|
|
gemfile = ./Gemfile;
|
|
lockfile = ./Gemfile.lock;
|
|
gemset = ./gemset.nix;
|
|
};
|
|
in
|
|
stdenv.mkDerivation {
|
|
name = "freeholdcottage-com";
|
|
buildInputs = [
|
|
env
|
|
ruby_3_3
|
|
rubyPackages_3_3.ffi
|
|
libffi
|
|
];
|
|
|
|
shellHook = ''
|
|
serve() {
|
|
${env}/bin/jekyll serve --watch &
|
|
JEKYLL_PID=$!
|
|
|
|
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"
|
|
'';
|
|
}
|