Compare commits

..

3 commits

Author SHA1 Message Date
Valentin Gagarin bdc7fb0c34 set a default location for documents
it turns out that setting a value appends to that.
the default only needs to be overridden when the symbolic name of the
document changes. while there's a chance people will inadvertently break
links that way, it's requires less up-front knowledge to work with.
2024-10-16 17:41:44 +02:00
Valentin Gagarin 7800a70df5 allow prefixing output paths of collection items 2024-10-16 17:28:38 +02:00
Valentin Gagarin 7c464be268 delete obsolete page 2024-10-16 01:18:40 +02:00
21 changed files with 67 additions and 93 deletions

View file

@ -9,9 +9,6 @@ in
pages.index = { link, ... }: { pages.index = { link, ... }: {
title = "Fediversity"; title = "Fediversity";
locations = [
"index.html"
];
description = "Fediversity web site"; description = "Fediversity web site";
summary = '' summary = ''
This web site hosts up-to-date information about the the NGI Zero Fediversity project. This web site hosts up-to-date information about the the NGI Zero Fediversity project.

View file

@ -6,9 +6,6 @@
summary = '' summary = ''
The Fediversity Project is a comprehensive effort to bring easy-to-use, hosted cloud services that have service portability and personal freedom at their core to everyone. The Fediversity Project is a comprehensive effort to bring easy-to-use, hosted cloud services that have service portability and personal freedom at their core to everyone.
''; '';
locations = [
"fediversity.html"
];
body = '' body = ''
Fediversity is a comprehensive effort to bring easy-to-use, hosted cloud services with service portability and personal freedom at their core to everyone. It wants to provide everyone with high-quality, secure IT systems for everyday use. Without tracking, without exploitation, in a way that runs everywhere and scales effortlessly. Fediversity is based on NixOS, a disruptive Linux distribution with a unique approach to package and configuration management. Built on top of the Nix package manager, NixOS is completely declarative, makes upgrading systems reliable, and has many other advantages. Because it is reproducible, it is ideally suited for complex deployment scenarios where consistent behaviour, stability and configurability matter. Fediversity is a comprehensive effort to bring easy-to-use, hosted cloud services with service portability and personal freedom at their core to everyone. It wants to provide everyone with high-quality, secure IT systems for everyday use. Without tracking, without exploitation, in a way that runs everywhere and scales effortlessly. Fediversity is based on NixOS, a disruptive Linux distribution with a unique approach to package and configuration management. Built on top of the Nix package manager, NixOS is completely declarative, makes upgrading systems reliable, and has many other advantages. Because it is reproducible, it is ideally suited for complex deployment scenarios where consistent behaviour, stability and configurability matter.

View file

@ -2,9 +2,6 @@
{ {
pages.grants = { pages.grants = {
title = "Grants"; title = "Grants";
locations = [
"grants.html"
];
description = "How to apply for grants as part of the Fediversity Project"; description = "How to apply for grants as part of the Fediversity Project";
summary = '' summary = ''
Fediversity will award 450 000 euro in small to medium-size R&D grants towards solutions that bring the next generation of social networks closer. We are seeking project proposals between 5.000 and 50.000 euros which should get you on your way. Fediversity will award 450 000 euro in small to medium-size R&D grants towards solutions that bring the next generation of social networks closer. We are seeking project proposals between 5.000 and 50.000 euros which should get you on your way.

View file

@ -18,9 +18,7 @@ in
in in
map map
(page: { (page: {
page = lib.recursiveUpdate page { page = lib.recursiveUpdate page { title = "${page.date}: ${page.title}"; };
title = "${page.date}: ${page.title}";
};
}) })
(lib.take 3 sorted); (lib.take 3 sorted);
} }

View file

@ -5,9 +5,6 @@
description = "Report from the NORDUnet Conference 2024"; description = "Report from the NORDUnet Conference 2024";
date = "2024-09-17"; date = "2024-09-17";
author = "Laurens Hof"; author = "Laurens Hof";
locations = [
"nordunet-conference-2024.html"
];
body = '' body = ''
Fediversity was represented in Bergen at the Nordunet Conference for 2024, with both the Internet Discourse Foundation and Nordunet themselves being present. This was a great opportunity for the different organisations in the consortium to meet with each other and exchange ideas. Fediversity was represented in Bergen at the Nordunet Conference for 2024, with both the Internet Discourse Foundation and Nordunet themselves being present. This was a great opportunity for the different organisations in the consortium to meet with each other and exchange ideas.

View file

@ -1,13 +1,10 @@
{ ... }: { config, lib, ... }:
{ {
collections.news.entry = { collections.news.entry = { link, ... }: {
title = "Fediversity project publicly announced"; title = "Fediversity project publicly announced";
description = "The Fediversity project has officially been announced"; description = "The Fediversity project has officially been announced";
date = "2024-01-01"; date = "2024-01-01";
author = "Laurens Hof"; author = "Laurens Hof";
locations = [
"fediversity-announced.html"
];
body = '' body = ''
The Consortium behind the Fediversity project announces that the project has officially been started. NLnet, Tweag, NorduNet and the Open Internet Discourse Foundation are working together to build a new service for cloud hosters. The Consortium behind the Fediversity project announces that the project has officially been started. NLnet, Tweag, NorduNet and the Open Internet Discourse Foundation are working together to build a new service for cloud hosters.

View file

@ -5,9 +5,6 @@
description = "Report from the PublicSpaces Conference 2024 - 'Take Back the Internet'"; description = "Report from the PublicSpaces Conference 2024 - 'Take Back the Internet'";
date = "2024-07-30"; date = "2024-07-30";
author = "Laurens Hof"; author = "Laurens Hof";
locations = [
"publicspaces-conference-2024.html"
];
body = '' body = ''
PublicSpaces and Waag Futurelabs recently held their yearly conference in Amsterdam, titled 'Taking Back the Internet'. PublicSpaces is a network of public organisations fighting for an internet based on public values. The Fediversity Project attended, to share ideas, and learn more about how people and organisations think about an ethical internet. If you are interested, you can view all sessions [here](https://conference.publicspaces.net/en/archive/pubconf2024) (hosted on PeerTube!). PublicSpaces and Waag Futurelabs recently held their yearly conference in Amsterdam, titled 'Taking Back the Internet'. PublicSpaces is a network of public organisations fighting for an internet based on public values. The Fediversity Project attended, to share ideas, and learn more about how people and organisations think about an ethical internet. If you are interested, you can view all sessions [here](https://conference.publicspaces.net/en/archive/pubconf2024) (hosted on PeerTube!).

View file

@ -5,9 +5,6 @@
description = "Fediversity tech session - NixOS and Kubernetes"; description = "Fediversity tech session - NixOS and Kubernetes";
date = "2024-08-05"; date = "2024-08-05";
author = "Laurens Hof"; author = "Laurens Hof";
locations = [
"tech-session.html"
];
body = '' body = ''
Recently Fediversity hosted a tech session on NixOS and Kubernetes. We invited people within the community to discuss some design considerations of the Fediversity project with us. Recently Fediversity hosted a tech session on NixOS and Kubernetes. We invited people within the community to discuss some design considerations of the Fediversity project with us.

View file

@ -5,9 +5,6 @@
description = "Announcing our new website for the Fediversity project"; description = "Announcing our new website for the Fediversity project";
date = "2024-05-15"; date = "2024-05-15";
author = "Laurens Hof"; author = "Laurens Hof";
locations = [
"website-launch.html"
];
body = '' body = ''
We are pleased to introduce the launch of our new website dedicated to the Fediversity project. We are pleased to introduce the launch of our new website dedicated to the Fediversity project.

View file

@ -6,9 +6,6 @@
summary = '' summary = ''
NLnet supports organisations and people who contribute to an open internet for all. They fund projects that help fix the internet through open hardware, open software, open standards, open science and open data. NLnet supports organisations and people who contribute to an open internet for all. They fund projects that help fix the internet through open hardware, open software, open standards, open science and open data.
''; '';
locations = [
"nlnet.html"
];
body = '' body = ''
The NLnet Foundation supports organisations and people who contribute to an open internet for all. NLnet funds projects that help fix the internet through open hardware, open software, open standards, open science and open data. After its historical contribution to the early internet in Europe in the 1980s, NLnet has been financially supporting the open internet since 1997. The NLnet Foundation supports organisations and people who contribute to an open internet for all. NLnet funds projects that help fix the internet through open hardware, open software, open standards, open science and open data. After its historical contribution to the early internet in Europe in the 1980s, NLnet has been financially supporting the open internet since 1997.

View file

@ -6,9 +6,6 @@
description = '' description = ''
NORDUnet is a collaboration of the National Research and Education Networks (NREN) of the Nordic countries. NORDUnet is a collaboration of the National Research and Education Networks (NREN) of the Nordic countries.
''; '';
locations = [
"nordunet.html"
];
body = '' body = ''
NORDUnet connects universities and research institutions across Denmark, Finland, Iceland, Norway, and Sweden. It enables collaboration, data sharing, and access to online resources for academic and research purposes. NORDUnet connects universities and research institutions across Denmark, Finland, Iceland, Norway, and Sweden. It enables collaboration, data sharing, and access to online resources for academic and research purposes.

View file

@ -7,9 +7,6 @@
description = '' description = ''
The Open Internet Discourse Foundation (OID) is founded on the belief that everyone deserves the freedom to express themselves and use the internet without constraints, and is committed to help build a better internet where individuals can truly be who they are. The Open Internet Discourse Foundation (OID) is founded on the belief that everyone deserves the freedom to express themselves and use the internet without constraints, and is committed to help build a better internet where individuals can truly be who they are.
''; '';
locations = [
"oid.html"
];
body = '' body = ''
The three pillars that are at the core of the OID Foundation: The three pillars that are at the core of the OID Foundation:

View file

@ -6,9 +6,6 @@
description = '' description = ''
Tweag is the open source program office (OSPO) of Modus Create, and has extensive experience working with Nix, and many people at the forefront of the Nix community are Tweagers Tweag is the open source program office (OSPO) of Modus Create, and has extensive experience working with Nix, and many people at the forefront of the Nix community are Tweagers
''; '';
locations = [
"tweag.html"
];
body = '' body = ''
Tweag is the open source program office (OSPO) of Modus Create, a global digital consulting firm that helps enterprises build competitive advantage through digital innovation. Tweagers are leading contributors to several open source projects from functional programming languages to cross-platform frameworks. Tweag has extensive experience working with Nix, and many people at the forefront of the Nix community are Tweagers. Tweag is the open source program office (OSPO) of Modus Create, a global digital consulting firm that helps enterprises build competitive advantage through digital innovation. Tweagers are leading contributors to several open source projects from functional programming languages to cross-platform frameworks. Tweag has extensive experience working with Nix, and many people at the forefront of the Nix community are Tweagers.
''; '';

View file

@ -1,11 +0,0 @@
---
title: "Consortium"
# meta title
meta_title: "Consortium"
# meta description
description: "The organisations behind the Fediversity Project"
# save as draft
draft: false
---
Information about the project. TODO.

17
lib.nix
View file

@ -52,16 +52,17 @@ rec {
inherit (lib) lists; inherit (lib) lists;
path1 = subpath.components path1'; path1 = subpath.components path1';
prefix1 = with lib; take (length path1 - 1) path1;
path2 = subpath.components path2'; path2 = subpath.components path2';
prefix2 = with lib; take (length path1 - 1) path2;
commonPrefixLength = with lists; commonPrefixLength = with lists;
findFirstIndex (i: i.fst != i.snd) findFirstIndex (i: i.fst != i.snd)
{ fst = null; snd = null; } (length prefix1)
(zipLists path1 path2); (zipLists prefix1 prefix2);
relativeComponents = with lists; relativeComponents = with lists;
[ "." ] ++ (replicate (length path1 - commonPrefixLength - 1) "..") ++ [ "." ] ++ (replicate (length prefix1 - commonPrefixLength) "..") ++ (drop commonPrefixLength path2);
(drop commonPrefixLength path2);
in in
join "/" relativeComponents; join "/" relativeComponents;
@ -98,13 +99,7 @@ rec {
merge = loc: defs: merge = loc: defs:
map map
(def: (def:
let elemType.merge (loc ++ [ "[definition ${toString def.file}]" ]) [{ inherit (def) file; value = def.value; }]
merged = lib.mergeDefinitions
(loc ++ [ "[definition ${toString def.file}]" ])
elemType
[{ inherit (def) file; value = def.value; }];
in
if merged ? mergedValue then merged.mergedValue else merged.value
) )
defs; defs;
check = elemType.check; check = elemType.check;

View file

@ -41,7 +41,7 @@ in
<link rel="canonical" href="${page.outPath}" /> <link rel="canonical" href="${page.outPath}" />
''; '';
body = '' body = ''
${templates.nav { menu = { menu = config.menus.main; }; }} ${templates.nav { inherit page; menu = { menu = config.menus.main; }; }}
${builtins.readFile (commonmark page.name page.body)} ${builtins.readFile (commonmark page.name page.body)}
''; '';
}); });
@ -55,7 +55,7 @@ in
} }
''; '';
body = '' body = ''
${templates.nav { menu = { menu = config.menus.main; }; }} ${templates.nav { inherit page; menu = { menu = config.menus.main; }; }}
${builtins.readFile (commonmark page.name page.body)} ${builtins.readFile (commonmark page.name page.body)}
''; '';
}); });
@ -76,20 +76,14 @@ in
let let
pages = lib.attrValues config.pages; pages = lib.attrValues config.pages;
collections = with lib; concatMap (collection: collection.entry) (attrValues config.collections); collections = with lib; concatMap (collection: collection.entry) (attrValues config.collections);
collections' = with lib; map
(
entry: recursiveUpdate entry {
locations = map (l: "${entry.collection.name}/${l}") entry.locations;
}
)
collections;
in in
with lib; foldl with lib; foldl
(acc: elem: acc // { (acc: elem: acc // {
"${head elem.locations}" = builtins.toFile "${elem.name}.html" elem.outputs.html; # TODO: we may or may not want to enforce the mapping of file types to output file name suffixes
"${head elem.locations}.html" = builtins.toFile "${elem.name}.html" elem.outputs.html;
}) })
{ } { }
(pages ++ collections'); (pages ++ collections);
options.build = mkOption { options.build = mkOption {
description = '' description = ''

View file

@ -14,16 +14,16 @@ rec {
<body> <body>
</html> </html>
''; '';
nav = { menu }: nav = { page, menu }:
let let
render-item = item: render-item = item:
if item ? menu then if item ? menu then
'' ''
<li>${item.menu.label} <li>${item.menu.label}
${lib.indent " " (nav { menu = item; })} ${lib.indent " " (nav { inherit page; menu = item; })}
'' ''
else else
if item ? page then ''<li><a href="${item.page}">${item.page.title}</a></li>'' if item ? page then ''<li><a href="${page.link item.page}">${item.page.title}</a></li>''
else ''<li><a href="${item.link.url}">${item.link.label}</a></li>'' else ''<li><a href="${item.link.url}">${item.link.label}</a></li>''
; ;
in in

View file

@ -27,9 +27,6 @@ in
}; };
}; };
config.name = lib.slug config.title; config.name = lib.slug config.title;
# TODO: this should be covered by the TBD `link` function instead,
# taking a historical list of collection names into account
config.outPath = "${collection.name}/${lib.head config.locations}";
config.outputs.html = lib.mkForce (cfg.templates.html.article cfg config); config.outputs.html = lib.mkForce (cfg.templates.html.article cfg config);
}; };
} }

View file

@ -52,11 +52,27 @@ in
type = types.str; type = types.str;
default = name; default = name;
}; };
entry = mkOption { prefixes = mkOption {
description = ''
List of historic output locations for files in the collection
The first element is the canonical location.
All other elements are used to create redirects to the canonical location.
The default entry is the symbolic name of the collection.
When changing the symbolic name, append the old one to your custom list and use `lib.mkForce` to make sure the default element will be overridden.
'';
type = with types; nonEmptyListOf str;
example = [ "." ];
default = [ config.name ];
};
entry = mkOption
{
description = "An entry in the collection"; description = "An entry in the collection";
type = types.collection (types.submodule ({ type = types.collection (types.submodule ({
_module.args.collection = config;
imports = [ config.type ]; imports = [ config.type ];
_module.args.collection = config;
process-locations = ls: with lib; concatMap (l: map (p: "${p}/${l}") config.prefixes) ls;
})); }));
}; };
}; };

View file

@ -6,7 +6,7 @@ let
; ;
in in
{ {
content-types.document = { name, config, link, ... }: { content-types.document = { name, config, options, link, ... }: {
config._module.args.link = config.link; config._module.args.link = config.link;
options = { options = {
name = mkOption { name = mkOption {
@ -17,20 +17,36 @@ in
# TODO: reconsider using `page.outPath` and what to put into `locations`. # TODO: reconsider using `page.outPath` and what to put into `locations`.
# maybe we can avoid having ".html" suffixes there. # maybe we can avoid having ".html" suffixes there.
# since templates can output multiple files, `html` is merely one of many things we *could* produce. # since templates can output multiple files, `html` is merely one of many things we *could* produce.
# TODO: make `apply` configurable so one can programmatically modify locations
locations = mkOption { locations = mkOption {
description = '' description = ''
List of historic output locations for the resulting file List of historic output locations for the resulting file
Elements are relative paths to output files, without suffix.
The suffix will be added depending on output file type.
The first element is the canonical location. The first element is the canonical location.
All other elements are used to create redirects to the canonical location. All other elements are used to create redirects to the canonical location.
The default entry is the symbolic name of the document.
When changing the symbolic name, append the old one to your custom list and use `lib.mkForce` to make sure the default element will be overridden.
''; '';
type = with types; nonEmptyListOf str; type = with types; nonEmptyListOf str;
apply = config.process-locations;
example = [ "about/overview" "index" ];
default = [ config.name ];
};
process-locations = mkOption {
description = "Function to post-process the output locations of contained document";
type = types.functionTo options.locations.type;
default = lib.id;
}; };
link = mkOption { link = mkOption {
description = "Helper function for transparent linking to other pages"; description = "Helper function for transparent linking to other pages";
type = with types; functionTo str; type = with types; functionTo str;
default = target: with lib; relativePath (head config.locations) (head target.locations); # TODO: we may want links to other representations,
# and currently the mapping of output types to output file
# names is soft.
default = target: with lib; "${relativePath config.outPath target.outPath}.html";
}; };
# TODO: may not need it when using `link`; could repurpose it to render the default template # TODO: may not need it when using `link`; could repurpose it to render the default template
outPath = mkOption { outPath = mkOption {

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, options, lib, ... }:
let let
inherit (lib) inherit (lib)
mkOption mkOption
@ -7,7 +7,12 @@ let
cfg = config; cfg = config;
subtype = baseModule: types.submodule [ subtype = baseModule: types.submodule [
baseModule baseModule
{ _module.freeformType = types.attrs; } {
_module.freeformType = types.attrs;
# XXX: this is supposed to be used with a finished value,
# and we don't want to process locations again.
process-locations = lib.mkForce lib.id;
}
]; ];
in in
{ {