jacekpoz
270d4ae4c0
this doesn't seem to entirely be working but it reloads? I got an older version on the actual site even though the file did change not sure what's wrong will try to fix this later
79 lines
2.1 KiB
Nix
79 lines
2.1 KiB
Nix
{
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
inherit (lib) getExe';
|
|
|
|
systemctl = getExe' pkgs.systemd "systemctl";
|
|
|
|
port = 4827;
|
|
sitePath = "/srv/web/jacekpoz.pl";
|
|
in {
|
|
services.caddy = {
|
|
enable = true;
|
|
virtualHosts = {
|
|
"jacekpoz.pl".extraConfig = ''
|
|
reverse_proxy localhost:${toString port}
|
|
'';
|
|
"jpoz.pl".extraConfig = ''
|
|
redir / https://jacekpoz.pl
|
|
redir /git https://jacekpoz.pl/posts/git-workflow.html
|
|
'';
|
|
"jacek.poziem.ski".extraConfig = ''
|
|
redir https://jacekpoz.pl
|
|
'';
|
|
};
|
|
};
|
|
|
|
users.groups.site = {};
|
|
|
|
users.users.site = {
|
|
isSystemUser = true;
|
|
group = "site";
|
|
};
|
|
|
|
systemd = {
|
|
services = {
|
|
pozback = {
|
|
description = "The backend for jacekpoz.pl";
|
|
after = ["network.target"];
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
ExecStart = "${inputs.pozsite.packages.${pkgs.system}.pozback}/bin/back";
|
|
Restart = "on-failure";
|
|
Environment = ''POZ_PORT="${toString port}" POZ_DIR="${sitePath}"'';
|
|
User = "site";
|
|
Group = "site";
|
|
};
|
|
|
|
path = with pkgs; [
|
|
fastfetch
|
|
colorized-logs
|
|
];
|
|
};
|
|
|
|
pozback-watcher = {
|
|
description = "Restarter for the backend";
|
|
after = ["network.target"];
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = "${systemctl} restart pozback.service";
|
|
};
|
|
};
|
|
};
|
|
paths.pozback-watcher = {
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
pathConfig = {
|
|
PathModified = sitePath;
|
|
Unit = "pozback-watcher.service";
|
|
};
|
|
};
|
|
};
|
|
}
|