From 95fd21c3784ecd4d3c30a3a27713a938711f1102 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 25 Jan 2024 17:19:16 +0100 Subject: [PATCH] feat(static): Refactor www-eleves config --- machines/web01/_configuration.nix | 1 - machines/web01/eleves.nix | 18 ------------------ machines/web01/static/default.nix | 16 ++++++++++++---- machines/web01/static/npins/sources.json | 11 +++++++++++ npins/sources.json | 11 ----------- 5 files changed, 23 insertions(+), 34 deletions(-) delete mode 100644 machines/web01/eleves.nix diff --git a/machines/web01/_configuration.nix b/machines/web01/_configuration.nix index fd55e74..9f6decb 100644 --- a/machines/web01/_configuration.nix +++ b/machines/web01/_configuration.nix @@ -11,7 +11,6 @@ lib.extra.mkConfig { # List of services to enable "castopod" "crabfit" - "eleves" "linkal" "matterbridge" "metis" diff --git a/machines/web01/eleves.nix b/machines/web01/eleves.nix deleted file mode 100644 index 939009e..0000000 --- a/machines/web01/eleves.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ sources, ... }: - -let - host = "eleves.dgnum.eu"; - serverAliases = [ ]; -in { - services.nginx.virtualHosts.${host} = { - inherit serverAliases; - - enableACME = true; - forceSSL = true; - root = "${sources.www-eleves.outPath}/www"; - - locations."/" = { - tryFiles = "$uri $uri/index.html /fr/$uri /en/$uri /fr/index.html"; - }; - }; -} diff --git a/machines/web01/static/default.nix b/machines/web01/static/default.nix index 3202a28..62c0b00 100644 --- a/machines/web01/static/default.nix +++ b/machines/web01/static/default.nix @@ -1,13 +1,21 @@ -_: +{ lib, ... }: let + inherit (lib) recursiveUpdate; websites = import ./npins; - mkVhost = name: - { outPath, ... }: { + mkVhost = + name: + { outPath, ... }: + { enableACME = true; forceSSL = true; root = "${outPath}/www"; }; +in -in { services.nginx.virtualHosts = builtins.mapAttrs mkVhost websites; } +{ + services.nginx.virtualHosts = recursiveUpdate (builtins.mapAttrs mkVhost websites) { + "eleves.dgnum.eu".locations."/".tryFiles = "$uri $uri/index.html /fr/$uri /en/$uri /fr/index.html"; + }; +} diff --git a/machines/web01/static/npins/sources.json b/machines/web01/static/npins/sources.json index b0ca5df..8d03291 100644 --- a/machines/web01/static/npins/sources.json +++ b/machines/web01/static/npins/sources.json @@ -11,6 +11,17 @@ "url": null, "hash": "0x1iyq52awazxyhsx07qv5slgwym0k3gkhbnfflqcn2jmwkir0yr" }, + "eleves.dgnum.eu": { + "type": "Git", + "repository": { + "type": "Git", + "url": "https://git.dgnum.eu/DGNum/eleves.dgnum.eu.git" + }, + "branch": "main", + "revision": "d28526a8cdbd1cce13071b50064fd8d4deadb1f5", + "url": null, + "hash": "0cdrywjwvh6sg8rlsm3ap2prksbizvdjbsmqdpdmnjs06ccxnl8c" + }, "interq.ens.fr": { "type": "Git", "repository": { diff --git a/npins/sources.json b/npins/sources.json index 9e02363..99a2406 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -142,17 +142,6 @@ "revision": "e5a17243cd3e684a7e67a91342fb7d11479c46b6", "url": "https://git.helsinki.tools/api/v4/projects/helsinki-systems%2Fwp4nix/repository/archive.tar.gz?sha=e5a17243cd3e684a7e67a91342fb7d11479c46b6", "hash": "168jl60kn7134ipilkm2skdaisxsyv3jkcpg485xl8n4zdv8gz8k" - }, - "www-eleves": { - "type": "Git", - "repository": { - "type": "Git", - "url": "https://git.dgnum.eu/DGNum/www.eleves.ens.fr.git" - }, - "branch": "main", - "revision": "d28526a8cdbd1cce13071b50064fd8d4deadb1f5", - "url": null, - "hash": "0cdrywjwvh6sg8rlsm3ap2prksbizvdjbsmqdpdmnjs06ccxnl8c" } }, "version": 3