{ pkgs, lib, ...}: let globals = import ../../config/globals.nix ; in { environment.systemPackages = with pkgs; [ hugo ]; systemd.services.hugo-build = { description = "Auto build du blog hugo"; serviceConfig = { Type = "oneshot"; WorkingDirectory = globals.services.levr.home ; ExecStart = ''${pkgs.hugo}/bin/hugo --minify build -d ${globals.services.levr.build}''; User = "lomig"; }; }; systemd.timers.hugo-build = { description = "Timer pour rebuild du blog"; wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "01:10" ; Persistent = true ; }; }; systemd.services.blog-sync = { description = "Synchronisation du dépôt Hugo"; serviceConfig = { Type = "oneshot"; WorkingDirectory = globals.services.levr.home; ExecStart = "${pkgs.git}/bin/git pull origin master"; User = "lomig"; }; environment = { PATH = lib.mkForce "${pkgs.openssh}/bin"; }; }; systemd.timers.blog-sync = { wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "01:00"; Persistent = true; }; }; services.caddy = { enable = true; virtualHosts = { "${globals.services.levr.url}" = { extraConfig = '' @http { protocol http } redir @http https://{host}{uri} permanent root * ${globals.services.levr.build} file_server log { output file /var/log/caddy/access-${globals.services.levr.url}.log } ''; }; }; }; }