diff options
Diffstat (limited to 'package.nix')
-rw-r--r-- | package.nix | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..0bb826e --- /dev/null +++ b/package.nix @@ -0,0 +1,78 @@ +{ + 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' + ''; +} |