Fediversity/website/content/default.nix

185 lines
5.8 KiB
Nix
Raw 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
2025-02-19 18:34:19 +01:00
pages.index =
{ config, link, ... }:
{
title = "Welcome to the Fediversity project";
description = "Fediversity web site";
summary = ''
This web site hosts up-to-date information about the the NGI Zero Fediversity project.
'';
body = ''
${pages.fediversity.summary}
2024-11-13 15:24:40 +01:00
2025-02-19 18:34:19 +01:00
[Learn more about Fediversity](${link pages.fediversity})
'';
outputs.html = (cfg.templates.html.page config).override (
2025-02-19 18:38:05 +01:00
_final: prev: {
2025-02-19 18:34:19 +01:00
html = {
head.title.text = "Fediversity";
head.link.stylesheets = prev.html.head.link.stylesheets ++ [
{ href = "${link cfg.assets."index.css"}"; }
];
body.content =
let
to-section =
{
2025-02-19 18:34:19 +01:00
heading,
body,
attrs ? { },
}:
{
2025-02-19 18:34:19 +01:00
section = {
heading.content = heading;
inherit attrs;
content = [
(cfg.templates.html.markdown {
name = "${config.name}-${lib.slug heading}";
inherit body;
})
];
};
};
in
[
(lib.head prev.html.body.content)
{
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}
2025-02-19 18:34:19 +01:00
[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.
2025-02-19 18:34:19 +01:00
${toString (
map
(partner: ''
### ${partner.title}
2025-02-19 18:34:19 +01:00
${partner.summary}
[Read more about ${partner.title}](${link partner})
'')
(
with pages;
[
nlnet
oid
tweag
nordunet
]
)
)}
'';
}
{
heading = "Fediverse explained";
body = ''
${toString (
map
(role: ''
### ${role.title}
2025-02-19 18:34:19 +01:00
${role.summary}
2025-02-19 18:34:19 +01:00
[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
);
}
]);
};
2025-02-19 18:34:19 +01:00
}
);
};
2025-02-19 18:34:19 +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
}