{ config, pkgs, lib, ... }: with lib; let cfg = config.within.services.graphviz; graphviz = pkgs.stdenv.mkDerivation { name = "GraphvizOnline"; src = pkgs.fetchFromGitHub { owner = "Xe"; repo = "GraphvizOnline"; rev = "98ab98e6dbabba984e49be2c8b46c470aca829fe"; sha256 = "l3BEmY20pfC1rWyQLz6j4pDPdZcv1FYKeIpBZUmosXc="; fetchSubmodules = false; }; phases = "installPhase"; installPhase = '' mkdir -p $out cp -vrf $src/* $out ''; }; in { options.within.services.graphviz.enable = mkEnableOption "Activates the graphviz site"; config = mkIf cfg.enable { services.nginx.virtualHosts."graphviz" = { serverName = "graphviz.christine.website"; locations."/".root = graphviz; forceSSL = true; useACMEHost = "christine.website"; extraConfig = '' access_log /var/log/nginx/graphviz.access.log; ''; }; services.cfdyndns.records = [ "graphviz.christine.website" ]; }; }