/ website / default.nix
default.nix
 1  {
 2    inputs,
 3    pkgs,
 4    manpages,
 5    mantohtml,
 6    depgraph-svg,
 7    ...
 8  }:
 9  
10  let
11    themeName = ((builtins.fromTOML (builtins.readFile "${inputs.goyo}/theme.toml")).name);
12  in
13  pkgs.stdenv.mkDerivation {
14    pname = "website";
15    version = "0.1.0";
16  
17    src = ./.;
18  
19    nativeBuildInputs = [ pkgs.zola ];
20  
21    configurePhase = ''
22      mkdir -p "themes/${themeName}"
23      cp -vr ${inputs.goyo}/* "themes/${themeName}"
24    '';
25  
26    buildPhase = ''
27      mkdir -p static/manpages
28      for file in ${manpages}/*.1; do
29        echo "$file => static/manpages/''$(echo $file | sed 's,.*\/,,; s,\.1,.html,')"
30        ${pkgs.lib.getExe mantohtml} $file > "static/manpages/''$(echo $file | sed 's,.*\/,,; s,\.1,.html,')"
31      done
32  
33      # link in depgraph
34      cp -v ${depgraph-svg}/depgraph.svg static/depgraph.svg
35  
36      zola build
37    '';
38  
39    installPhase = ''
40      cp -vr public $out
41    '';
42  }