nixos-config/modules/sites/levr.porzh.me.nix
2025-10-09 02:27:33 +02:00

60 lines
1.4 KiB
Nix

{ pkgs, lib, ...}: {
environment.systemPackages = with pkgs; [
hugo
];
systemd.services.hugo-build = {
description = "Auto build du blog hugo";
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/srv/blog" ;
ExecStart = ''${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 = "01:10" ;
Persistent = true ;
};
};
systemd.services.blog-sync = {
description = "Synchronisation du dépôt Hugo";
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/srv/blog";
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 = {
"levr.porzh.me" = {
extraConfig = ''
@http {
protocol http
}
redir @http https://{host}{uri} permanent
root * /srv/blog/public
file_server
log {
output file /var/log/caddy/access-levr.porzh.me.log
}
'';
};
};
};
}