about summary refs log tree commit diff
path: root/tvix/website/default.nix
blob: a2fc247e4a489a8fd02ad975ed31b2c7935b2e64 (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
{ depot, lib, pkgs, ... }:

let
  description = "Rust implementation of the purely-functional Nix package manager";

  # https://developers.google.com/search/docs/advanced/structured-data/
  # https://schema.org/SoftwareApplication
  structuredData = {
    "@context" = "https://schema.org";
    "@type" = "SoftwareApplication";
    name = "Tvix";
    url = "https://tvix.dev";
    abstract = description;
    applicationCategory = "DeveloperApplication";
    contributor = "https://tvl.fyi";
    image = "https://tvix.dev/logo.webp";
  };

  # All Tvix-related blog posts from the main TVL website
  tvixPosts = builtins.filter
    (post: !(post.draft or false) && (lib.hasInfix "Tvix" post.title))
    depot.web.tvl.blog.posts;

  postListEntries = map (p: "* [${p.title}](https://tvl.fyi/blog/${p.key})") tvixPosts;

  landing = depot.web.tvl.template {
    title = "Tvix - A new implementation of Nix";
    content = ''
      ${builtins.readFile ./landing-en.md}
      ${builtins.concatStringsSep "\n" postListEntries}
    '';

    extraHead = ''
      <meta name="description" content="${description}">
      <script type="application/ld+json">
        ${builtins.toJSON structuredData}
      </script>
    '';
  };

in
pkgs.runCommand "tvix-website" { } ''
  mkdir $out
  cp ${landing} $out/index.html
  cp ${depot.tvix.logo}/logo.webp $out/
''