From 1c3d44c2894502f610072bfa22d88b604c79e957 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Mon, 25 Sep 2023 00:40:47 +0200 Subject: [PATCH] feat(web01): Deploy metis on calendrier.dgnum.eu --- machines/web01/_configuration.nix | 1 + machines/web01/metis/default.nix | 31 +++++++++++++++++++++++++++++++ machines/web01/metis/package.nix | 23 +++++++++++++++++++++++ npins/sources.json | 11 +++++++++++ 4 files changed, 66 insertions(+) create mode 100644 machines/web01/metis/default.nix create mode 100644 machines/web01/metis/package.nix diff --git a/machines/web01/_configuration.nix b/machines/web01/_configuration.nix index 2410d92..e323df0 100644 --- a/machines/web01/_configuration.nix +++ b/machines/web01/_configuration.nix @@ -12,6 +12,7 @@ let # List of services to enable enabledServices = [ + "metis" "plausible" # "wordpress" ]; diff --git a/machines/web01/metis/default.nix b/machines/web01/metis/default.nix new file mode 100644 index 0000000..1a42ad5 --- /dev/null +++ b/machines/web01/metis/default.nix @@ -0,0 +1,31 @@ +{ lib, pkgs, sources, ... }: + +let + host = "calendrier.dgnum.eu"; + + package = pkgs.callPackage ./package.nix { src = sources.metis; }; + + providers = { + klub-reseau = "nuage.beta.rz.ens.wtf"; + eleves-ens = "cloud.eleves.ens.fr"; + frama-agenda = "framagenda.org"; + }; +in { + services.nginx.virtualHosts.${host} = { + enableACME = true; + forceSSL = true; + root = package; + + locations = lib.mapAttrs' (name: attrs: + lib.nameValuePair "/cal/${name}/" { + extraConfig = '' + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass https://${ + providers.${name} + }/remote.php/dav/public-calendars/; + ''; + }) providers; + }; +} diff --git a/machines/web01/metis/package.nix b/machines/web01/metis/package.nix new file mode 100644 index 0000000..eaae274 --- /dev/null +++ b/machines/web01/metis/package.nix @@ -0,0 +1,23 @@ +{ lib, fetchgit, buildNpmPackage, src }: + +buildNpmPackage { + pname = "metis"; + version = "unstable"; + + inherit src; + + npmDepsHash = "sha256-RbjWNVY8KlPP9ajQRnrsWhOZiiyyMGQSY39lmZnTC1I="; + + installPhase = '' + cp -r public $out + ''; + + meta = with lib; { + description = ""; + homepage = "https://git.dgnum.eu/DGNum/metis"; + license = licenses.unfree; # FIXME: nix-init did not found a license + maintainers = with maintainers; [ thubrecht ]; + mainProgram = "metis"; + platforms = platforms.all; + }; +} diff --git a/npins/sources.json b/npins/sources.json index e4d9a4c..955554b 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -41,6 +41,17 @@ "url": null, "hash": "1bashjbh71dqs32yld7ihw2vz0vrad73pc35crf3qck8ssgpzv7d" }, + "metis": { + "type": "Git", + "repository": { + "type": "Git", + "url": "https://git.dgnum.eu/DGNum/metis" + }, + "branch": "master", + "revision": "f086aab2bf940035acab3ea6c3c15ebd966ebe8c", + "url": null, + "hash": "0inivyfsq86bwsfqcrflj9mkx1lcsn0g2y2lpk03ibh417jxq1vx" + }, "nix-lib": { "type": "GitRelease", "repository": {