nixos-config/modules/sites/levr.porzh.me.nix

44 lines
1 KiB
Nix
Raw Normal View History

2025-10-05 08:20:57 +02:00
_: {
2025-10-08 11:03:57 +02:00
environment.systemPackages = with pkgs; [
hugo
];
systemd.services.hugo-build = {
description = "Auto build du blog hugo";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/srv/blog" ;
ExecStart = ''
${pkgs.git}/bin/git pull origin master
${pkgs.hugo}/bin/hugo --minify build -d /srv/blog/public
'';
User = "lomig";
};
};
systemd.timers.hugo-build = {
description = "Timer pour rebuild du blog";
wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = "daily" ;
};
2025-09-20 14:57:06 +02:00
services.caddy = {
enable = true;
virtualHosts = {
"levr.porzh.me" = {
extraConfig = ''
2025-10-05 08:20:57 +02:00
@http {
protocol http
}
redir @http https://{host}{uri} permanent
root * /srv/blog/public
file_server
2025-09-24 23:33:06 +02:00
2025-10-05 08:20:57 +02:00
log {
output file /var/log/caddy/access-levr.porzh.me.log
}
2025-09-20 14:57:06 +02:00
'';
};
};
};
}