]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add website for Nathanael
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 23 Apr 2020 11:02:52 +0000 (13:02 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 23 Apr 2020 11:02:52 +0000 (13:02 +0200)
modules/private/default.nix
modules/private/websites/default.nix
modules/private/websites/nathanael/villon.nix [new file with mode: 0644]

index dbb8361203e64db40de703c3e5b9a9c42792249a..477723897caccf7f55f329cb521bbe73a988140c 100644 (file)
@@ -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;
 
index 5c33e1c15372037c4e293cf123abc08d672f2ee8..2cc6c8151af8923bef68a4a2c887fd86dd21c928 100644 (file)
@@ -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 (file)
index 0000000..7482de1
--- /dev/null
@@ -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}
+
+        <Directory ${varDir}>
+          DirectoryIndex index.htm index.html
+          Options Indexes FollowSymLinks MultiViews Includes
+          AllowOverride None
+          Require all granted
+        </Directory>
+          ''
+      ];
+    };
+  };
+}