diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-25 21:53:41 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-25 21:53:41 +0200 |
commit | b90c68e0246d0c41b23ba751d5b5f0dcd3565c60 (patch) | |
tree | 249fd4778029bb027235945f9717c42ace966f8e | |
parent | feat(src/content/writings): Use `path` to change the path to the posts (diff) | |
download | b-peetz.de-b90c68e0246d0c41b23ba751d5b5f0dcd3565c60.zip |
fix(package.nix): Patch the pdf files into the final artefact
-rw-r--r-- | package.nix | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/package.nix b/package.nix index 7f52163..be7a10e 100644 --- a/package.nix +++ b/package.nix @@ -3,6 +3,7 @@ system, # Deps zola, + fd, # Data facharbeit, essay, @@ -18,34 +19,60 @@ stdenv.mkDerivation { nativeBuildInputs = [ zola + fd ]; - buildPhase = '' - zola build + buildPhase = let + installWriting = name: source: + # bash + '' + pdf_path="./writings/${name}" + rm --recursive "$pdf_path/" - cd ./public || exit 1 + install -D "${source}" "$pdf_path" + fd . --type file --exec sed --in-place "s|$pdf_path/|$pdf_path|g" - mkdir --parents ./dead-trees{,/chemistry,/philosophy} + export base="$pdf_path" + ''; + in + # bash + '' + zola build - install -D ${essay.outputs.packages."${system}".default}/philosophy/kant_and_free_software.pdf ./writings/philosophy/kant_and_free_software.pdf - base="./writings/philosophy/kant_and_free_software.pdf" - ln --symbolic --force --relative "$base" ./writings/kant-and-free-software.pdf + cd ./public || exit 1 - # 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 + # Remove some useless stuff + rm --recursive ./categories - install -D ${facharbeit.outputs.packages."${system}".default}/chemistry/facharbeit.pdf ./writings/chemistry/facharbeit.pdf - base="./writings/chemistry/facharbeit.pdf" - ln --symbolic --force --relative "$base" ./writings/raman-spectroscopy.pdf + mkdir --parents ./dead-trees{,/chemistry,/philosophy} - # 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 - ''; + { + ${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' ''; } |