nix/nixos/consensus/configuration.nix
2025-07-06 12:51:06 -05:00

138 lines
3.2 KiB
Nix

{
lib,
pkgs,
config,
...
}: {
imports = [
./hardware-configuration.nix
./backups.nix
];
sops = {
secrets = {
"env" = {sopsFile = ../../secrets/cf-acme.yaml;};
};
};
documentation = {
enable = lib.mkDefault false;
info.enable = lib.mkDefault false;
man.enable = lib.mkDefault false;
nixos.enable = lib.mkDefault false;
};
environment.systemPackages = with pkgs; [
git
nvim-pkg
docker-compose
tmux
];
services = {
zfs.autoScrub.enable = true;
zfs.autoSnapshot.enable = true;
tailscale.enable = true;
k3s = {
enable = true;
role = "server";
extraFlags = toString [
"--disable=traefik"
];
};
openssh = {
enable = true;
ports = [2022];
settings = {
PasswordAuthentication = false;
PermitRootLogin = "prohibit-password";
};
};
immich = {
enable = true;
port = 2283;
host = "localhost";
openFirewall = true;
machine-learning.enable = true;
mediaLocation = "/rice/immich";
};
nginx = {
enable = true;
virtualHosts."img.10110110.xyz" = {
useACMEHost = "10110110.xyz";
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.immich.port}";
proxyWebsockets = true;
recommendedProxySettings = true;
extraConfig = ''
client_max_body_size 50000M;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
send_timeout 600s;
'';
};
};
};
};
boot = {
tmp.cleanOnBoot = true;
supportedFilesystems = ["zfs"];
zfs.forceImportRoot = false;
zfs.extraPools = ["rice"];
};
networking.hostId = "91238132";
zramSwap.enable = false;
swapDevices = [
{
device = "/swapfile";
size = 8 * 1024;
}
];
virtualisation.docker.enable = true;
networking = {
hostName = "consensus";
firewall = {
enable = true;
allowedTCPPorts = [
22
443
2022
6443
25565
9001
30303
];
allowedUDPPorts = [
9001
30303
];
logRefusedConnections = true;
};
};
users.users = {
root = {
openssh.authorizedKeys.keys = [''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHM4Zr0PFN7QdOG2aJ+nuzRCK6caulrpY6bphA1Ppl8Y e@t14''];
};
e = {
isNormalUser = true;
extraGroups = ["wheel"];
home = "/home/e";
openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHM4Zr0PFN7QdOG2aJ+nuzRCK6caulrpY6bphA1Ppl8Y e@t14''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAdo4PS8myKaKAdyIqSFj2VJ+oZ9DNRIp7PBz8IWKjjy''
];
};
};
security.sudo-rs.wheelNeedsPassword = false;
security.acme = {
acceptTerms = true;
defaults.email = "acme@10110110.xyz";
certs = {
"10110110.xyz" = {
domain = "*.10110110.xyz";
group = config.services.nginx.group;
dnsProvider = "cloudflare";
environmentFile = config.sops.secrets."env".path;
};
};
};
nix.settings.trusted-users = ["e"];
system.stateVersion = "23.11";
}