Compare commits
4 commits
e863aea052
...
9f53c984f4
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f53c984f4 | |||
| 4828dc5a21 | |||
| 2d801ae06a | |||
| d8f2812003 |
4 changed files with 35 additions and 0 deletions
19
roles/server/borg.nix
Normal file
19
roles/server/borg.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{...}: {
|
||||||
|
services.borgbackup = {
|
||||||
|
repos = {
|
||||||
|
backups = {
|
||||||
|
allowSubRepos = true;
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEMtbHUcYanH/guWaKNjGr/IGa8gvI/xRTcNAI9yXhnK BorgBackup backups key"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.openssh.settings = {
|
||||||
|
AllowUsers = [
|
||||||
|
"borg@*.tailscale"
|
||||||
|
"borg@192.168.1.0/24"
|
||||||
|
"borg@localhost"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,19 @@
|
||||||
file_server browse
|
file_server browse
|
||||||
root * /srv/dl/
|
root * /srv/dl/
|
||||||
'';
|
'';
|
||||||
|
script = pkgs.writeShellApplication {
|
||||||
|
name = "wait-for-tailscale-ip";
|
||||||
|
runtimeInputs = [pkgs.iproute2];
|
||||||
|
text = ''
|
||||||
|
# Based on https://github.com/tailscale/tailscale/issues/11504#issuecomment-2113331262
|
||||||
|
echo Waiting for tailscale0 to get an IP adress..
|
||||||
|
for i in {1..300}; do
|
||||||
|
if ip addr show dev tailscale0 | grep -q 'inet '; then break; fi
|
||||||
|
echo "Waiting $i/240 seconds"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -71,6 +84,7 @@ in {
|
||||||
# in too little time
|
# in too little time
|
||||||
services.caddy.serviceConfig.RestartSec = lib.mkForce "120s";
|
services.caddy.serviceConfig.RestartSec = lib.mkForce "120s";
|
||||||
services.caddy.unitConfig.StartLimitBurst = lib.mkForce "infinity";
|
services.caddy.unitConfig.StartLimitBurst = lib.mkForce "infinity";
|
||||||
|
services.caddy.preStart = "${script}/bin/wait-for-tailscale-ip";
|
||||||
};
|
};
|
||||||
programs.rust-motd.settings.service_status.Caddy = "caddy";
|
programs.rust-motd.settings.service_status.Caddy = "caddy";
|
||||||
networking.firewall.allowedTCPPorts = [443 80];
|
networking.firewall.allowedTCPPorts = [443 80];
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
./headscale.nix
|
./headscale.nix
|
||||||
./caddy.nix
|
./caddy.nix
|
||||||
./rust_motd.nix
|
./rust_motd.nix
|
||||||
|
./borg.nix
|
||||||
./adguard.nix
|
./adguard.nix
|
||||||
./grafana.nix
|
./grafana.nix
|
||||||
./prometheus.nix
|
./prometheus.nix
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ in {
|
||||||
UseDns = true;
|
UseDns = true;
|
||||||
PermitRootLogin = "no";
|
PermitRootLogin = "no";
|
||||||
PasswordAuthentication = false;
|
PasswordAuthentication = false;
|
||||||
|
AllowUsers = ["toast"];
|
||||||
};
|
};
|
||||||
# The forgejo module is fucky so I can't set this with the nixos option
|
# The forgejo module is fucky so I can't set this with the nixos option
|
||||||
# https://github.com/NixOS/nixpkgs/issues/306205
|
# https://github.com/NixOS/nixpkgs/issues/306205
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue