2026-05-29 19:30:07 +02:00
|
|
|
{ lib, pkgs, modulesPath, ... }:
|
|
|
|
|
{
|
|
|
|
|
imports = [
|
|
|
|
|
"${modulesPath}/virtualisation/oci-image.nix"
|
|
|
|
|
../../modules/services/cloud-init.nix
|
2026-05-30 15:18:13 +02:00
|
|
|
../../modules/services/forgejo.nix
|
2026-05-29 19:30:07 +02:00
|
|
|
../../modules/services/nginx.nix
|
|
|
|
|
../../modules/services/oci-authorized-keys.nix
|
2026-05-30 15:18:13 +02:00
|
|
|
../../modules/services/tor.nix
|
2026-05-29 19:30:07 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
|
hostName = "blogbox";
|
|
|
|
|
networkmanager.enable = lib.mkForce false;
|
|
|
|
|
firewall.allowedTCPPorts = [
|
|
|
|
|
22
|
|
|
|
|
80
|
|
|
|
|
443
|
2026-05-30 15:18:13 +02:00
|
|
|
22000
|
|
|
|
|
24601
|
|
|
|
|
];
|
|
|
|
|
firewall.allowedUDPPorts = [
|
|
|
|
|
22000
|
2026-05-29 19:30:07 +02:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
boot = {
|
2026-05-30 09:38:41 +02:00
|
|
|
initrd.availableKernelModules = [
|
|
|
|
|
"virtio_pci"
|
|
|
|
|
"virtio_blk"
|
|
|
|
|
"virtio_scsi"
|
|
|
|
|
"virtio_net"
|
|
|
|
|
"xhci_pci"
|
|
|
|
|
];
|
2026-05-29 19:30:07 +02:00
|
|
|
loader.systemd-boot.configurationLimit = lib.mkForce 3;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nix = {
|
|
|
|
|
settings = {
|
2026-05-30 15:18:13 +02:00
|
|
|
min-free = lib.mkForce (512 * 1024 * 1024);
|
|
|
|
|
max-free = lib.mkForce (2 * 1024 * 1024 * 1024);
|
2026-05-29 19:30:07 +02:00
|
|
|
};
|
|
|
|
|
gc = {
|
|
|
|
|
dates = lib.mkForce "daily";
|
|
|
|
|
options = lib.mkForce "--delete-older-than 3d";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-30 15:18:13 +02:00
|
|
|
virtualisation = {
|
|
|
|
|
docker.enable = lib.mkForce false;
|
|
|
|
|
podman = {
|
|
|
|
|
enable = true;
|
|
|
|
|
dockerSocket.enable = true;
|
|
|
|
|
autoPrune = {
|
|
|
|
|
enable = true;
|
|
|
|
|
dates = "daily";
|
|
|
|
|
flags = [ "--all" ];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
users.users.alisceon.extraGroups = [ "systemd-journal" ];
|
|
|
|
|
|
|
|
|
|
alisceon = {
|
|
|
|
|
cloud-init = {
|
|
|
|
|
enable = true;
|
|
|
|
|
defaultShell = "/run/current-system/sw/bin/xonsh";
|
|
|
|
|
};
|
|
|
|
|
ociAuthorizedKeys.enable = true;
|
2026-05-30 09:38:41 +02:00
|
|
|
};
|
|
|
|
|
|
2026-05-29 19:30:07 +02:00
|
|
|
security = {
|
|
|
|
|
acme = {
|
|
|
|
|
acceptTerms = true;
|
|
|
|
|
defaults.email = "acme@alisceon.com";
|
|
|
|
|
};
|
|
|
|
|
sudo-rs.wheelNeedsPassword = false;
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-30 15:18:13 +02:00
|
|
|
services.openssh.settings = {
|
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
|
PermitRootLogin = lib.mkForce "prohibit-password";
|
2026-05-29 19:30:07 +02:00
|
|
|
};
|
|
|
|
|
|
2026-05-30 15:18:13 +02:00
|
|
|
services.syncthing = {
|
|
|
|
|
enable = true;
|
|
|
|
|
dataDir = "/var/lib/syncthing";
|
|
|
|
|
guiAddress = "127.0.0.1:8384";
|
|
|
|
|
openDefaultPorts = false;
|
|
|
|
|
overrideDevices = false;
|
|
|
|
|
overrideFolders = false;
|
|
|
|
|
settings = {
|
|
|
|
|
gui = {
|
|
|
|
|
insecureAdminAccess = false;
|
|
|
|
|
insecureSkipHostcheck = false;
|
2026-05-29 19:30:07 +02:00
|
|
|
};
|
2026-05-30 15:18:13 +02:00
|
|
|
options = {
|
|
|
|
|
globalAnnounceEnabled = false;
|
|
|
|
|
localAnnounceEnabled = false;
|
|
|
|
|
listenAddresses = [
|
|
|
|
|
"tcp://0.0.0.0:22000"
|
|
|
|
|
"quic://0.0.0.0:22000"
|
2026-05-30 09:38:41 +02:00
|
|
|
];
|
2026-05-30 15:18:13 +02:00
|
|
|
natEnabled = false;
|
|
|
|
|
relaysEnabled = false;
|
|
|
|
|
urAccepted = -1;
|
2026-05-30 09:38:41 +02:00
|
|
|
};
|
|
|
|
|
};
|
2026-05-30 15:18:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
alisceon.forgejo.domain = "forgejo.alisceon.com";
|
2026-05-30 09:38:41 +02:00
|
|
|
|
2026-05-30 15:18:13 +02:00
|
|
|
services.gitea-actions-runner.instances.alisceon-core-podman.labels = [
|
|
|
|
|
"podman"
|
|
|
|
|
"x86_64"
|
|
|
|
|
"amd64"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
|
${"forgejo.alisceon.com"} = {
|
|
|
|
|
serverName = "forgejo.alisceon.com";
|
|
|
|
|
forceSSL = true;
|
|
|
|
|
enableACME = true;
|
|
|
|
|
locations."/" = {
|
|
|
|
|
proxyPass = "http://127.0.0.1:3000";
|
|
|
|
|
recommendedProxySettings = true;
|
2026-05-29 19:30:07 +02:00
|
|
|
};
|
|
|
|
|
};
|
2026-05-30 15:18:13 +02:00
|
|
|
${"syncthing.alisceon.com"} = {
|
|
|
|
|
serverName = "syncthing.alisceon.com";
|
|
|
|
|
forceSSL = true;
|
|
|
|
|
enableACME = true;
|
|
|
|
|
locations."/" = {
|
|
|
|
|
proxyPass = "http://127.0.0.1:8384";
|
|
|
|
|
recommendedProxySettings = false;
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
proxy_set_header Host $proxy_host;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_read_timeout 600s;
|
|
|
|
|
proxy_send_timeout 600s;
|
|
|
|
|
'';
|
2026-05-30 09:38:41 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-30 15:18:13 +02:00
|
|
|
systemd.services.syncthing = {
|
2026-05-30 09:38:41 +02:00
|
|
|
serviceConfig = {
|
2026-05-30 15:18:13 +02:00
|
|
|
LockPersonality = true;
|
|
|
|
|
PrivateIPC = true;
|
|
|
|
|
ProcSubset = "pid";
|
|
|
|
|
ProtectClock = true;
|
|
|
|
|
ProtectHome = true;
|
|
|
|
|
ProtectProc = "invisible";
|
|
|
|
|
ProtectSystem = "strict";
|
|
|
|
|
ReadWritePaths = [ "/var/lib/syncthing" ];
|
|
|
|
|
RemoveIPC = true;
|
|
|
|
|
RestrictAddressFamilies = [
|
|
|
|
|
"AF_INET"
|
|
|
|
|
"AF_INET6"
|
|
|
|
|
"AF_NETLINK"
|
|
|
|
|
"AF_UNIX"
|
|
|
|
|
];
|
|
|
|
|
SystemCallArchitectures = "native";
|
|
|
|
|
UMask = "0077";
|
2026-05-30 09:38:41 +02:00
|
|
|
};
|
2026-05-29 19:30:07 +02:00
|
|
|
};
|
|
|
|
|
|
2026-05-30 15:18:13 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
curl
|
|
|
|
|
git
|
|
|
|
|
htop
|
|
|
|
|
jq
|
|
|
|
|
vim
|
|
|
|
|
wget
|
|
|
|
|
];
|
2026-05-29 19:30:07 +02:00
|
|
|
|
|
|
|
|
system.stateVersion = lib.mkForce "25.11";
|
|
|
|
|
}
|