{ stdenv, system, # Deps zola, fd, # Data facharbeit, essay, }: stdenv.mkDerivation { pname = "b-peetz.de"; version = "v1.0"; src = ./src; # Run local preferLocalBuild = true; allowSubstitutes = false; nativeBuildInputs = [ zola fd ]; buildPhase = let installWriting = name: source: # bash '' pdf_path="./writings/${name}" rm --recursive "$pdf_path/" install -D "${source}" "$pdf_path" fd . --type file --exec sed --in-place "s|$pdf_path/|$pdf_path|g" export base="$pdf_path" ''; in # bash '' zola build cd ./public || exit 1 # Remove some useless stuff rm --recursive ./categories mkdir --parents ./dead-trees{,/chemistry,/philosophy} { ${installWriting "kant-and-free-software.pdf" "${essay.outputs.packages."${system}".default}/philosophy/kant_and_free_software.pdf"} # NOTE: This link is for backward compatibility, as I have given out links with that url <2024-07-13> ln --symbolic --relative "$base" ./dead-trees/kant_and_free_software.pdf ln --symbolic --relative "$base" ./dead-trees/philosophy/kant_and_free_software.pdf } { ${installWriting "raman-spectroscopy.pdf" "${facharbeit.outputs.packages."${system}".default}/chemistry/facharbeit.pdf"} # NOTE: This link is for backward compatibility, as I have given out links with that url <2024-07-13> ln --symbolic --relative "$base" ./dead-trees/raman_spectrometer.pdf ln --symbolic --relative "$base" ./dead-trees/chemistry/facharbeit.pdf } ''; installPhase = '' install -d $out/ cp --recursive . $out/ # # Make the website relative (this allows serving it from the ./result via python for # # debugging.) # fd . $out --type file --exec sed --in-place 's|https://b-peetz.de/|/|g' # fd . $out --type file --exec sed --in-place 's|https://b-peetz.de/|/|g' # # fd . $out --type file --exec sed --in-place 's|https://b-peetz.de|/|g' # fd . $out --type file --exec sed --in-place 's|https://b-peetz.de|/|g' ''; }