From 8722d69346d5cee802e205e18a2b23d3d4fb4805 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 23 Apr 2020 13:02:52 +0200 Subject: [PATCH] Add website for Nathanael --- modules/private/default.nix | 2 + modules/private/websites/default.nix | 2 + modules/private/websites/nathanael/villon.nix | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 modules/private/websites/nathanael/villon.nix diff --git a/modules/private/default.nix b/modules/private/default.nix index dbb8361..4777238 100644 --- a/modules/private/default.nix +++ b/modules/private/default.nix @@ -53,6 +53,8 @@ set = { nassimeProd = ./websites/nassime/production.nix; + nathanaelVillon = ./websites/nathanael/villon.nix; + papaMaisonBbc = ./websites/papa/maison_bbc.nix; papaSurveillance = ./websites/papa/surveillance.nix; diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index 5c33e1c..2cc6c81 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix @@ -270,6 +270,8 @@ in nassime.production.enable = true; + nathanael.villon.enable = true; + papa = { surveillance.enable = true; maison_bbc.enable = true; diff --git a/modules/private/websites/nathanael/villon.nix b/modules/private/websites/nathanael/villon.nix new file mode 100644 index 0000000..7482de1 --- /dev/null +++ b/modules/private/websites/nathanael/villon.nix @@ -0,0 +1,42 @@ +{ lib, pkgs, config, ... }: +let + cfg = config.myServices.websites.nathanael.villon; + varDir = "/var/lib/ftp/nathanael"; + env = config.myEnv.websites.nathanael; + domain = "sntvillon.immae.eu"; + apacheUser = config.services.httpd.Prod.user; + apacheGroup = config.services.httpd.Prod.group; +in { + options.myServices.websites.nathanael.villon.enable = lib.mkEnableOption "enable Nathanael's website"; + + config = lib.mkIf cfg.enable { + services.webstats.sites = [ { name = domain; } ]; + + system.activationScripts.nathanael_villon = { + deps = [ "users" ]; + text = '' + install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir} + ''; + }; + security.acme.certs."ftp".extraDomains."${domain}" = null; + + services.websites.env.production.vhostConfs.nathanael_villon = { + certName = "nathanael"; + certMainHost = domain; + hosts = [ domain ]; + root = varDir; + extraConfig = [ + '' + Use Stats ${domain} + + + DirectoryIndex index.htm index.html + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride None + Require all granted + + '' + ]; + }; + }; +} -- 2.41.0