aboutsummaryrefslogblamecommitdiff
path: root/nixops/modules/websites/tellesflorian/default.nix
blob: 16d788fc7cfbe93474ab63cf7a9df75079248d80 (plain) (tree)
1
2
3
4
5
6
7
8
                                             


                                                         



                                                                                                 









                                                                                   
                                            
                                                                              
                                                                                     
                                                                                                   

                                                                                    



                                                                                            



                                                                                                         
                                                  






                                          
{ lib, pkgs, config, myconfig, mylibs, ... }:
let
    adminer = pkgs.callPackage ../commons/adminer.nix {};

    tellesflorian = pkgs.callPackage ./tellesflorian.nix { inherit (mylibs) fetchedGitPrivate; };
    tellesflorian_dev  = tellesflorian {
      config = myconfig.env.websites.tellesflorian.integration;
    };

    cfg = config.services.myWebsites.TellesFlorian;
in {
  options.services.myWebsites.TellesFlorian = {
    integration = {
      enable = lib.mkEnableOption "enable Florian Telles's website in integration";
    };
  };

  config = lib.mkIf cfg.integration.enable {
    mySecrets.keys = tellesflorian_dev.keys;
    security.acme.certs."eldiron".extraDomains."app.tellesflorian.com" = null;
    services.myPhpfpm.preStart.tellesflorian_dev = tellesflorian_dev.phpFpm.preStart;
    services.myPhpfpm.serviceDependencies.tellesflorian_dev = tellesflorian_dev.phpFpm.serviceDeps;
    services.myPhpfpm.poolConfigs.tellesflorian_dev = tellesflorian_dev.phpFpm.pool;
    system.activationScripts.tellesflorian_dev = tellesflorian_dev.activationScript;
    system.extraSystemBuilderCmds = ''
      mkdir -p $out/webapps
      ln -s ${tellesflorian_dev.webRoot} $out/webapps/${tellesflorian_dev.apache.webappName}
      '';
    services.myWebsites.integration.modules = adminer.apache.modules ++ tellesflorian_dev.apache.modules;
    services.myWebsites.integration.vhostConfs.tellesflorian = {
      certName    = "eldiron";
      hosts       = ["app.tellesflorian.com" ];
      root        = tellesflorian_dev.apache.root;
      extraConfig = [
        tellesflorian_dev.apache.vhostConf
        adminer.apache.vhostConf
      ];
    };
  };
}