Fediversity/website/content/default.nix

150 lines
4.4 KiB
Nix
Raw Permalink Normal View History

2024-11-13 15:24:41 +01:00
{ config, lib, ... }:
2024-11-13 15:24:40 +01:00
let
inherit (config) pages;
cfg = config;
2024-11-13 15:24:40 +01:00
in
{
2024-11-13 15:24:41 +01:00
imports = lib.nixFiles ./.;
2024-11-13 15:24:40 +01:00
collections.news.type = cfg.content-types.article;
collections.events.type = cfg.content-types.event;
2024-11-13 15:24:41 +01:00
pages.index = { config, link, ... }: {
title = "Welcome to the Fediversity project";
2024-11-13 15:24:40 +01:00
description = "Fediversity web site";
summary = ''
This web site hosts up-to-date information about the the NGI Zero Fediversity project.
'';
body = ''
2024-11-13 15:24:40 +01:00
${pages.fediversity.summary}
[Learn more about Fediversity](${link pages.fediversity})
2024-11-13 15:24:40 +01:00
'';
outputs.html = (cfg.templates.html.page config).override (final: prev: {
html = {
head.title.text = "Fediversity";
2024-11-13 15:24:41 +01:00
head.link.stylesheets = prev.html.head.link.stylesheets ++ [
{ href = "${link cfg.assets."index.css"}"; }
];
body.content =
let
prev-content = prev.html.body.content;
to-section = { heading, body, attrs ? { } }: {
section = {
heading.content = heading;
inherit attrs;
content = [
(cfg.templates.html.markdown {
name = "${config.name}-${lib.slug heading}";
inherit body;
})
];
};
};
in
[
(lib.head prev-content) # header
{
section = {
attrs = { };
heading.content = config.title;
content = [
(cfg.templates.html.markdown { inherit (config) name body; })
]
++
(map to-section [
{
heading = "Fediversity grants";
body = ''
${pages.grants.summary}
[Learn more about Fediversity grants](${link pages.grants})
'';
}
{
heading = "Consortium";
body = ''
The Consortium behind the Fediversity project is a cooperation between NLnet, Open Internet Discourse Foundation, NORDUnet and Tweag.
${toString (map (partner: ''
### ${partner.title}
${partner.summary}
[Read more about ${partner.title}](${link partner})
'') (with pages; [ nlnet oid tweag nordunet ]))}
'';
}
{
heading = "Fediverse explained";
body = ''
${toString (map (role: ''
### ${role.title}
${role.summary}
[Read more about ${role.title}](${link role})
'') (with pages; [ individuals developers european-commission ]))}
'';
}
]);
};
}
]
++
(map to-section [
{
heading = "News";
attrs = { class = [ "collection" ]; };
body =
let
sorted = with lib; reverseList (sortOn (entry: entry.date) cfg.collections.news.entry);
in
lib.join "\n" (map
(article: ''
- ${article.date} [${article.title}](${link article})
'')
sorted);
}
{
heading = "Events";
attrs = { class = [ "collection" ]; };
body =
let
sorted = with lib; reverseList (sortOn (entry: entry.start-date) cfg.collections.events.entry);
in
lib.join "\n" (map
(article: ''
- ${article.start-date} [${article.title}](${link article})
'')
sorted);
}
]);
};
});
2024-11-13 15:24:40 +01:00
};
assets."index.css".path = with lib; builtins.toFile
"index.css"
''
section h1, section h2, section h3
{
text-align: center;
}
section h1 {
font-size: 3em;
}
section h2 {
font-size: 2.5em;
}
section h3 {
font-size: 1.5em;
}
section.collection h1 {
font-size: 2em;
text-align: left;
}
'';
2024-11-13 15:24:40 +01:00
}