summaryrefslogtreecommitdiff
path: root/flora/services/blog.nix
blob: e78152f2d81f39e7f72b7efea7a7970d3ef13165 (plain)
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
{ config, lib, pkgs, inputs, ... }:

let
  lux = pkgs.stdenv.mkDerivation {
    name = "gtfs-mdbooks";
    src = pkgs.fetchgit {
      url = "https://stuebinm.eu/git/lux";
      rev = "refs/heads/master";
      sha256 = "sha256-L2y5SEGOaoWl+jQGP3TmpQQLojjkRAjiRjbwhGKOg14=";
    };
    buildInputs = [ pkgs.mdbook ];
    buildPhase = ''
      cd documentation/book
      mdbook build
    '';
    installPhase = ''
      mkdir -p $out
      cp -r book/* $out
    '';
  };
  gtfsBooks = pkgs.stdenv.mkDerivation {
    name = "gtfs-mdbooks";
    src = inputs.gtfsBooks;
    buildInputs = [ pkgs.mdbook ];
    buildPhase = ''
      ./build.sh
    '';
    installPhase = ''
      mkdir -p $out
      mv gtfs-book-html $out/gtfs
      mv gtfs-realtime-book-html $out/gtfs-realtime
      cp -r ${lux.outPath} $out/lux
    '';
  };
in


{
  services.nginx.virtualHosts."stuebinm.eu" = {
    enableACME = true;
    forceSSL = true;
    locations."/".root = import inputs.blog { inherit pkgs; };
    locations."/bookshelf/".alias = "${gtfsBooks.outPath}/";
  };
}