summary refs log tree commit diff stats
path: root/package.nix
blob: 7f521635681a3bfbf0205ffb0a68d778b8729cfe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  stdenv,
  system,
  # Deps
  zola,
  # Data
  facharbeit,
  essay,
}:
stdenv.mkDerivation {
  pname = "b-peetz.de";
  version = "v1.0";
  src = ./src;

  # Run local
  preferLocalBuild = true;
  allowSubstitutes = false;

  nativeBuildInputs = [
    zola
  ];

  buildPhase = ''
    zola build

    cd ./public || exit 1

    mkdir --parents ./dead-trees{,/chemistry,/philosophy}

    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

    # 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

    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

    # 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/
  '';
}