aboutsummaryrefslogblamecommitdiff
path: root/modules/private/websites/nathanael/villon.nix
blob: 7482de1167ef691ee6d870d0a932a447cf03352d (plain) (tree)









































                                                                                                        
{ 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>
          ''
      ];
    };
  };
}