summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.nix61
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:&#x2F;&#x2F;b-peetz.de&#x2F;|/|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:&#x2F;&#x2F;b-peetz.de|/|g'
'';
}