From 4292bc495f398ccc124eed8c2598e4ed80fae737 Mon Sep 17 00:00:00 2001 From: valentin gagarin Date: Wed, 13 Nov 2024 15:24:40 +0100 Subject: [PATCH] PoC: build site from nix files --- .gitignore | 1 + content/english/pages/Grants.md | 17 ---- content/fediversity.nix | 19 +++++ content/grants.nix | 17 ++++ content/index.nix | 22 +++++ {content => content_}/english/_index.md | 4 +- .../english/authors/_index.md | 0 .../english/authors/laurens-hof.md | 0 .../english/blog/New-website-launch.md | 0 {content => content_}/english/blog/_index.md | 0 .../english/blog/fediversity-tech-session.md | 0 .../english/blog/nordunet-conference-2024.md | 0 .../english/blog/project-launch.md | 0 .../english/blog/publicspaces-conference.md | 0 .../english/contact/_index.md | 0 .../english/events/_index.md | 0 .../events/owc-annual-conference-2024.md | 0 .../events/publicspaces-annual-conference.md | 0 .../events/waag-state-internet-2024.md | 0 .../english/pages/Consortium.md | 0 .../english/pages/Developers.md | 0 {content => content_}/english/pages/EC.md | 0 .../english/pages/Fediversity.md | 0 content_/english/pages/Grants.md | 17 ++++ .../english/pages/Individuals.md | 0 {content => content_}/english/pages/NLnet.md | 0 .../english/pages/NORDUnet.md | 0 {content => content_}/english/pages/OID.md | 0 {content => content_}/english/pages/Tweag.md | 0 .../english/pages/privacy-policy.md | 0 .../english/sections/call-to-action.md | 0 .../english/sections/testimonial.md | 0 default.nix | 36 +++++++++ lib.nix | 18 +++++ npins/default.nix | 80 +++++++++++++++++++ npins/sources.json | 11 +++ shell.nix | 1 + 37 files changed, 224 insertions(+), 19 deletions(-) create mode 100644 .gitignore delete mode 100755 content/english/pages/Grants.md create mode 100644 content/fediversity.nix create mode 100644 content/grants.nix create mode 100644 content/index.nix rename {content => content_}/english/_index.md (86%) rename {content => content_}/english/authors/_index.md (100%) rename {content => content_}/english/authors/laurens-hof.md (100%) rename {content => content_}/english/blog/New-website-launch.md (100%) rename {content => content_}/english/blog/_index.md (100%) rename {content => content_}/english/blog/fediversity-tech-session.md (100%) rename {content => content_}/english/blog/nordunet-conference-2024.md (100%) rename {content => content_}/english/blog/project-launch.md (100%) rename {content => content_}/english/blog/publicspaces-conference.md (100%) rename {content => content_}/english/contact/_index.md (100%) rename {content => content_}/english/events/_index.md (100%) rename {content => content_}/english/events/owc-annual-conference-2024.md (100%) rename {content => content_}/english/events/publicspaces-annual-conference.md (100%) rename {content => content_}/english/events/waag-state-internet-2024.md (100%) rename {content => content_}/english/pages/Consortium.md (100%) rename {content => content_}/english/pages/Developers.md (100%) rename {content => content_}/english/pages/EC.md (100%) rename {content => content_}/english/pages/Fediversity.md (100%) create mode 100755 content_/english/pages/Grants.md rename {content => content_}/english/pages/Individuals.md (100%) rename {content => content_}/english/pages/NLnet.md (100%) rename {content => content_}/english/pages/NORDUnet.md (100%) rename {content => content_}/english/pages/OID.md (100%) rename {content => content_}/english/pages/Tweag.md (100%) rename {content => content_}/english/pages/privacy-policy.md (100%) rename {content => content_}/english/sections/call-to-action.md (100%) rename {content => content_}/english/sections/testimonial.md (100%) create mode 100644 default.nix create mode 100644 lib.nix create mode 100644 npins/default.nix create mode 100644 npins/sources.json create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b2be92b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/content/english/pages/Grants.md b/content/english/pages/Grants.md deleted file mode 100755 index 7554fbf6..00000000 --- a/content/english/pages/Grants.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Grants" -# meta title -meta_title: "Grants" -# meta description -description: "How to apply for grants as part of the Fediversity Project." -# save as draft -draft: false ---- - -Fediversity invites other people to join this ambitious development effort. It is a vast domain with many more challenges than what any preconceived effort could tackle by itself. This is why we invite your contribution to help us reshape the state of play, and together create an open, trustworthy and reliable internet for all. - -This is your opportunity to make a real difference. You tell us how your project can help Fediversity go harder, better, faster, stronger. In order to enable you to make such contributions, NLnet will award 450 000 euro in small to medium-size R&D grants towards solutions that bring the next generation of social networks closer. NLnet is seeking project proposals between 5.000 and 50.000 euro’s — which should get you on your way. - -Noteworthy fact: many projects which are to be deployed inside Fediversity were themselves bootstrapped on precisely such a grant from NGI, and now it is your turn. - -For more information on how to apply, check the NLnet website. diff --git a/content/fediversity.nix b/content/fediversity.nix new file mode 100644 index 00000000..b6510786 --- /dev/null +++ b/content/fediversity.nix @@ -0,0 +1,19 @@ +rec { + title = "Fediversity"; + description = "More information about the Fediversity project"; + 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. + ''; + outPath = "fediversity.html"; + body = '' + # ${title} + + 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 scenario’s where consistent behaviour, stability and configurability matter. + + One such “complex” deployment scenario is running state-of-the-art services for the Fediverse, like PeerTube, Mastodon, Owncast or Lemmy — especially if you want to for instance add services like live chat or transcoding. But even running more traditional services like modern e-mail servers with possible whistles and bells can be daunting. The same holds for deploying a VPN, private cloud storage, wiki, etc. Fediversity will enable all of these use cases, and more — finally bringing these to the market in a way that is as conveient as using a hosted service. + + Fediversity is a pilot funded by the European Commission, building on many projects funding through the Next Generation Internet initiative. The results of the project should greatly simplify the creation and delivery of robust and secure services, on the web and beyond. + + Fediversity will deliver an ambitious development effort, but this is a vast domain with many more challenges than what any preconceived effort could tackle by itself. This is why we invite your contribution to help us reshape the state of play, and together create an open, trustworthy and reliable internet for all. + ''; +} diff --git a/content/grants.nix b/content/grants.nix new file mode 100644 index 00000000..fb5eb3e6 --- /dev/null +++ b/content/grants.nix @@ -0,0 +1,17 @@ +{ + title = "Grants"; + description = "How to apply for grants as part of the Fediversity Project"; + 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 euro’s — which should get you on your way. + ''; + outPath = "grants.html"; + body = '' + Fediversity invites other people to join this ambitious development effort. It is a vast domain with many more challenges than what any preconceived effort could tackle by itself. This is why we invite your contribution to help us reshape the state of play, and together create an open, trustworthy and reliable internet for all. + + This is your opportunity to make a real difference. You tell us how your project can help Fediversity go harder, better, faster, stronger. In order to enable you to make such contributions, NLnet will award 450 000 euro in small to medium-size R&D grants towards solutions that bring the next generation of social networks closer. NLnet is seeking project proposals between 5.000 and 50.000 euro’s — which should get you on your way. + + Noteworthy fact: many projects which are to be deployed inside Fediversity were themselves bootstrapped on precisely such a grant from NGI, and now it is your turn. + + For more information on how to apply, check the NLnet website. + ''; +} diff --git a/content/index.nix b/content/index.nix new file mode 100644 index 00000000..23724738 --- /dev/null +++ b/content/index.nix @@ -0,0 +1,22 @@ +let + grants = import ./grants.nix; + fediversity = import ./fediversity.nix; +in +{ + title = "Fediversity"; + description = "NGI Zero Fediversity"; + outPath = "index.html"; + body = '' + # Welcome to the Fediversity project + + ${fediversity.summary} + + [Learn more about Fediversity](./${fediversity}) + + # Fediversity grants + + ${grants.summary} + + [Learn more about our grants](./${grants}) + ''; +} diff --git a/content/english/_index.md b/content_/english/_index.md similarity index 86% rename from content/english/_index.md rename to content_/english/_index.md index 4e441438..20884aaf 100755 --- a/content/english/_index.md +++ b/content_/english/_index.md @@ -2,7 +2,7 @@ # Banner banner: title: "Welcome to the Fediversity Project" - content: "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." + content: "" # image: "/images/checkbox-illustration-scaled.png" image: "/images/home.svg" button: @@ -55,7 +55,7 @@ features3: features: - title: "Fediversity Grants" image: "/images/stepping-up.png" - content: "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 euro’s — which should get you on your way." + content: "" button: enable: true label: "Learn more" diff --git a/content/english/authors/_index.md b/content_/english/authors/_index.md similarity index 100% rename from content/english/authors/_index.md rename to content_/english/authors/_index.md diff --git a/content/english/authors/laurens-hof.md b/content_/english/authors/laurens-hof.md similarity index 100% rename from content/english/authors/laurens-hof.md rename to content_/english/authors/laurens-hof.md diff --git a/content/english/blog/New-website-launch.md b/content_/english/blog/New-website-launch.md similarity index 100% rename from content/english/blog/New-website-launch.md rename to content_/english/blog/New-website-launch.md diff --git a/content/english/blog/_index.md b/content_/english/blog/_index.md similarity index 100% rename from content/english/blog/_index.md rename to content_/english/blog/_index.md diff --git a/content/english/blog/fediversity-tech-session.md b/content_/english/blog/fediversity-tech-session.md similarity index 100% rename from content/english/blog/fediversity-tech-session.md rename to content_/english/blog/fediversity-tech-session.md diff --git a/content/english/blog/nordunet-conference-2024.md b/content_/english/blog/nordunet-conference-2024.md similarity index 100% rename from content/english/blog/nordunet-conference-2024.md rename to content_/english/blog/nordunet-conference-2024.md diff --git a/content/english/blog/project-launch.md b/content_/english/blog/project-launch.md similarity index 100% rename from content/english/blog/project-launch.md rename to content_/english/blog/project-launch.md diff --git a/content/english/blog/publicspaces-conference.md b/content_/english/blog/publicspaces-conference.md similarity index 100% rename from content/english/blog/publicspaces-conference.md rename to content_/english/blog/publicspaces-conference.md diff --git a/content/english/contact/_index.md b/content_/english/contact/_index.md similarity index 100% rename from content/english/contact/_index.md rename to content_/english/contact/_index.md diff --git a/content/english/events/_index.md b/content_/english/events/_index.md similarity index 100% rename from content/english/events/_index.md rename to content_/english/events/_index.md diff --git a/content/english/events/owc-annual-conference-2024.md b/content_/english/events/owc-annual-conference-2024.md similarity index 100% rename from content/english/events/owc-annual-conference-2024.md rename to content_/english/events/owc-annual-conference-2024.md diff --git a/content/english/events/publicspaces-annual-conference.md b/content_/english/events/publicspaces-annual-conference.md similarity index 100% rename from content/english/events/publicspaces-annual-conference.md rename to content_/english/events/publicspaces-annual-conference.md diff --git a/content/english/events/waag-state-internet-2024.md b/content_/english/events/waag-state-internet-2024.md similarity index 100% rename from content/english/events/waag-state-internet-2024.md rename to content_/english/events/waag-state-internet-2024.md diff --git a/content/english/pages/Consortium.md b/content_/english/pages/Consortium.md similarity index 100% rename from content/english/pages/Consortium.md rename to content_/english/pages/Consortium.md diff --git a/content/english/pages/Developers.md b/content_/english/pages/Developers.md similarity index 100% rename from content/english/pages/Developers.md rename to content_/english/pages/Developers.md diff --git a/content/english/pages/EC.md b/content_/english/pages/EC.md similarity index 100% rename from content/english/pages/EC.md rename to content_/english/pages/EC.md diff --git a/content/english/pages/Fediversity.md b/content_/english/pages/Fediversity.md similarity index 100% rename from content/english/pages/Fediversity.md rename to content_/english/pages/Fediversity.md diff --git a/content_/english/pages/Grants.md b/content_/english/pages/Grants.md new file mode 100755 index 00000000..7e229382 --- /dev/null +++ b/content_/english/pages/Grants.md @@ -0,0 +1,17 @@ +{ +meta = { + title = "Grants"; + description = "How to apply for grants as part of the Fediversity Project"; +}; +body = '' + Fediversity invites other people to join this ambitious development effort. It is a vast domain with many more challenges than what any preconceived effort could tackle by itself. This is why we invite your contribution to help us reshape the state of play, and together create an open, trustworthy and reliable internet for all. + + This is your opportunity to make a real difference. You tell us how your project can help Fediversity go harder, better, faster, stronger. In order to enable you to make such contributions, NLnet will award 450 000 euro in small to medium-size R&D grants towards solutions that bring the next generation of social networks closer. NLnet is seeking project proposals between 5.000 and 50.000 euro’s — which should get you on your way. + + Noteworthy fact: many projects which are to be deployed inside Fediversity were themselves bootstrapped on precisely such a grant from NGI, and now it is your turn. + + For more information on how to apply, check the NLnet website. +''; +} +--- + diff --git a/content/english/pages/Individuals.md b/content_/english/pages/Individuals.md similarity index 100% rename from content/english/pages/Individuals.md rename to content_/english/pages/Individuals.md diff --git a/content/english/pages/NLnet.md b/content_/english/pages/NLnet.md similarity index 100% rename from content/english/pages/NLnet.md rename to content_/english/pages/NLnet.md diff --git a/content/english/pages/NORDUnet.md b/content_/english/pages/NORDUnet.md similarity index 100% rename from content/english/pages/NORDUnet.md rename to content_/english/pages/NORDUnet.md diff --git a/content/english/pages/OID.md b/content_/english/pages/OID.md similarity index 100% rename from content/english/pages/OID.md rename to content_/english/pages/OID.md diff --git a/content/english/pages/Tweag.md b/content_/english/pages/Tweag.md similarity index 100% rename from content/english/pages/Tweag.md rename to content_/english/pages/Tweag.md diff --git a/content/english/pages/privacy-policy.md b/content_/english/pages/privacy-policy.md similarity index 100% rename from content/english/pages/privacy-policy.md rename to content_/english/pages/privacy-policy.md diff --git a/content/english/sections/call-to-action.md b/content_/english/sections/call-to-action.md similarity index 100% rename from content/english/sections/call-to-action.md rename to content_/english/sections/call-to-action.md diff --git a/content/english/sections/testimonial.md b/content_/english/sections/testimonial.md similarity index 100% rename from content/english/sections/testimonial.md rename to content_/english/sections/testimonial.md diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..7a56fdb6 --- /dev/null +++ b/default.nix @@ -0,0 +1,36 @@ +{ sources ? import ./npins +, system ? builtins.currentSystem +, pkgs ? import sources.nixpkgs { + inherit system; + config = { }; + overlays = [ ]; + } +, lib ? import "${sources.nixpkgs}/lib" +, +}: +let + lib' = pkgs.callPackage ./lib.nix { }; + join = lib.concatStringsSep; +in +{ + site = pkgs.stdenv.mkDerivation { + name = "fediversity.eu"; + src = ./content; + buildPhase = '' + true + ''; + installPhase = '' + mkdir $out + '' + join "\n" (lib.mapAttrsToList + (name: value: '' + cp ${value} $out/${name} + '') + (lib'.files ./content)); + }; + shell = pkgs.mkShellNoCC { + packages = with pkgs; [ + cmark + npins + ]; + }; +} diff --git a/lib.nix b/lib.nix new file mode 100644 index 00000000..33770db7 --- /dev/null +++ b/lib.nix @@ -0,0 +1,18 @@ +{ pkgs, lib, ... }: +{ + files = dir: lib.mapAttrs' + ( + name: value: + let + html = "${lib.removeSuffix ".nix" name}.html"; + md = "${lib.removeSuffix ".nix" name}.md"; + in + { + name = html; + value = pkgs.runCommand html { buildInputs = with pkgs; [ cmark ]; } '' + cmark ${builtins.toFile md (import "${dir}/${name}").body} > $out + ''; + } + ) + (builtins.readDir dir); +} diff --git a/npins/default.nix b/npins/default.nix new file mode 100644 index 00000000..5e7d086e --- /dev/null +++ b/npins/default.nix @@ -0,0 +1,80 @@ +# Generated by npins. Do not modify; will be overwritten regularly +let + data = builtins.fromJSON (builtins.readFile ./sources.json); + version = data.version; + + mkSource = + spec: + assert spec ? type; + let + path = + if spec.type == "Git" then + mkGitSource spec + else if spec.type == "GitRelease" then + mkGitSource spec + else if spec.type == "PyPi" then + mkPyPiSource spec + else if spec.type == "Channel" then + mkChannelSource spec + else + builtins.throw "Unknown source type ${spec.type}"; + in + spec // { outPath = path; }; + + mkGitSource = + { + repository, + revision, + url ? null, + hash, + branch ? null, + ... + }: + assert repository ? type; + # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository + # In the latter case, there we will always be an url to the tarball + if url != null then + (builtins.fetchTarball { + inherit url; + sha256 = hash; # FIXME: check nix version & use SRI hashes + }) + else + assert repository.type == "Git"; + let + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url; + + short = builtins.substring 0 7 rev; + + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; + name = urlToName repository.url revision; + in + builtins.fetchGit { + url = repository.url; + rev = revision; + inherit name; + # hash = hash; + }; + + mkPyPiSource = + { url, hash, ... }: + builtins.fetchurl { + inherit url; + sha256 = hash; + }; + + mkChannelSource = + { url, hash, ... }: + builtins.fetchTarball { + inherit url; + sha256 = hash; + }; +in +if version == 3 then + builtins.mapAttrs (_: mkSource) data.pins +else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json new file mode 100644 index 00000000..ea60a220 --- /dev/null +++ b/npins/sources.json @@ -0,0 +1,11 @@ +{ + "pins": { + "nixpkgs": { + "type": "Channel", + "name": "nixpkgs-unstable", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre691017.b69de56fac8c/nixexprs.tar.xz", + "hash": "0z32pj0lh5ng2a6cn0qfmka8cynnygckn5615mkaxq2aplkvgzx3" + } + }, + "version": 3 +} \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..a6bdf202 --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./. { }).shell