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

61 lines
1.4 KiB
Nix
Raw Normal View History

2025-10-08 11:40:24 +02:00
{ pkgs, lib, ...}: {
2025-10-08 11:03:57 +02:00
environment.systemPackages = with pkgs; [
hugo
];
systemd.services.hugo-build = {
description = "Auto build du blog hugo";
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/srv/blog" ;
2025-10-09 02:27:33 +02:00
ExecStart = ''${pkgs.hugo}/bin/hugo --minify build -d /srv/blog/public'';
2025-10-08 11:03:57 +02:00
User = "lomig";
};
};
systemd.timers.hugo-build = {
description = "Timer pour rebuild du blog";
wantedBy = [ "timers.target" ];
2025-10-09 02:27:33 +02:00
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;
};
2025-10-08 11:03:57 +02:00
};
2025-09-20 14:57:06 +02:00
services.caddy = {
enable = true;
virtualHosts = {
"levr.porzh.me" = {
extraConfig = ''
2025-10-09 02:27:33 +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-09 02:27:33 +02:00
log {
output file /var/log/caddy/access-levr.porzh.me.log
}
2025-09-20 14:57:06 +02:00
'';
};
};
};
2025-10-09 02:27:33 +02:00
}