nix-configs/nixos-configurations/zeus.nix

554 lines
14 KiB
Nix
Raw Normal View History

2024-09-19 20:46:32 -04:00
{
config,
pkgs,
inputs,
2024-09-19 21:56:38 -04:00
ezModules,
2024-09-20 19:43:01 -04:00
modulesPath,
lib,
2024-09-19 20:46:32 -04:00
...
}:
2024-09-19 21:56:38 -04:00
let
pkgs-unstable = import inputs.nixunstable { inherit (pkgs.stdenv) system; };
in
2024-04-25 20:43:21 -04:00
{
2024-09-05 19:08:29 -04:00
imports = [
2024-09-20 19:43:01 -04:00
"${modulesPath}/installer/scan/not-detected.nix"
2024-09-19 21:56:38 -04:00
inputs.impermanence.nixosModules.impermanence
inputs.nixos-hardware.nixosModules.supermicro
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower
inputs.nixos-hardware.nixosModules.common-pc
ezModules.aarch64-emu
ezModules.networkd-base
ezModules.smartd
ezModules.plymouth
2024-09-30 20:37:45 -04:00
ezModules.docker-proxy
2024-05-11 12:51:25 -04:00
];
2024-04-25 20:43:21 -04:00
2024-05-27 13:00:39 -04:00
boot = {
2024-09-20 19:43:01 -04:00
initrd.availableKernelModules = [
"ohci_pci"
"ehci_pci"
"sata_nv"
"sd_mod"
];
2024-05-27 13:00:39 -04:00
loader = {
grub = {
enable = true;
efiSupport = true;
mirroredBoots = [
{
devices = [ "nodev" ];
path = "/efi";
}
{
devices = [ "nodev" ];
path = "/efi1";
}
];
};
2024-09-20 19:43:01 -04:00
2024-05-27 13:00:39 -04:00
efi = {
2024-05-27 13:15:09 -04:00
canTouchEfiVariables = true;
2024-05-27 13:00:39 -04:00
efiSysMountPoint = "/efi";
};
};
2024-09-20 19:43:01 -04:00
kernelModules = [ "kvm-amd" ];
2024-05-27 13:00:39 -04:00
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
};
2024-05-26 20:35:04 -04:00
2024-09-20 19:43:01 -04:00
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
options = [
"defaults"
"mode=755"
];
};
"/persist" = {
device = "zroot/root";
fsType = "zfs";
neededForBoot = true;
};
"/boot" = {
device = "zboot/boot";
fsType = "zfs";
};
"/home" = {
device = "zroot/home";
fsType = "zfs";
};
"/nix" = {
device = "zroot/nix";
fsType = "zfs";
};
"/var" = {
device = "zroot/var";
fsType = "zfs";
};
"/video-data" = {
device = "rpool/video-data";
fsType = "zfs";
};
"/efi" = {
device = "/dev/disk/by-uuid/6ED6-2ED0";
fsType = "vfat";
options = [ "nofail" ];
};
"/efi1" = {
device = "/dev/disk/by-uuid/6A4C-BAFE";
fsType = "vfat";
options = [ "nofail" ];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/aecf6400-9c9f-43f9-8c57-08f3c8a633e7"; }
{ device = "/dev/disk/by-uuid/3fca7d18-441c-4f39-adad-ffd882b1f210"; }
];
2024-08-19 16:41:12 -04:00
sops = {
2024-08-28 21:24:00 -04:00
secrets."tailscale/authkey" = { };
2024-08-19 16:41:12 -04:00
templates."docker.env".content = ''
TAILSCALE_AUTHKEY=${config.sops.placeholder."tailscale/authkey"}
'';
};
2024-09-20 19:43:01 -04:00
networking = {
hostName = "zeus"; # Define your hostname.
hostId = "9e95b576";
};
2024-08-20 15:00:33 -04:00
systemd.services = {
recyclarr = {
2024-09-19 20:46:32 -04:00
script = "${pkgs-unstable.recyclarr}/bin/recyclarr sync";
2024-08-20 15:00:33 -04:00
startAt = "daily";
};
};
2024-04-25 20:43:21 -04:00
systemd.network.netdevs = {
bond0 = {
netdevConfig = {
Name = "bond0";
Kind = "bond";
};
2024-09-05 19:08:29 -04:00
bondConfig = {
Mode = "active-backup";
};
2024-04-25 20:43:21 -04:00
};
lan-shim = {
netdevConfig = {
Name = "lan-shim";
Kind = "macvlan";
MACAddress = "3e:53:37:25:08:ef";
};
2024-09-05 19:08:29 -04:00
macvlanConfig = {
Mode = "bridge";
};
2024-04-25 20:43:21 -04:00
};
};
systemd.network.networks = {
"00-bondage" = {
name = "eno*";
2024-04-25 20:43:21 -04:00
networkConfig.Bond = "bond0";
};
bond0 = {
name = "bond0";
networkConfig.MACVLAN = "lan-shim";
};
lan-shim = {
name = "lan-shim";
2024-09-05 19:08:29 -04:00
address = [
"10.42.69.100/24"
"fd72:3dd5:21ae:3c97:101b:87ff:fe86:5f01/64"
];
2024-04-25 20:43:21 -04:00
dns = [ "10.42.69.2" ];
domains = [ "icanttype.org" ];
gateway = [ "10.42.69.1" ];
};
};
virtualisation = {
podman = {
defaultNetwork.settings.dns_enabled = true;
2024-09-04 18:32:12 -04:00
autoPrune.enable = true;
2024-04-25 20:43:21 -04:00
};
oci-containers.containers = {
swag = {
image = "lscr.io/linuxserver/swag:2.9.0-ls292";
volumes = [ "swag-config:/config" ];
environment = {
2024-05-11 12:51:25 -04:00
TZ = "America/New_York";
URL = "icanttype.org";
VALIDATION = "dns";
SUBDOMAINS = "wildcard";
DNSPLUGIN = "cloudflare";
DOCKER_HOST = "dockerproxy";
2024-09-05 19:08:29 -04:00
DOCKER_MODS = "linuxserver/mods:swag-dashboard|linuxserver/mods:swag-auto-proxy|linuxserver/mods:universal-docker|linuxserver/mods:universal-cloudflared";
2024-05-11 12:51:25 -04:00
CF_ZONE_ID = "4e68852334290a922718696a0986e75a";
CF_ACCOUNT_ID = "5c1c252b9d9a9af6ea3a5de8590f36fa";
CF_API_TOKEN = "mRfY8ubtFUxzVuehI6WFipSQFIcstCNds7RF5FTQ";
CF_TUNNEL_NAME = "icanttype.org";
CF_TUNNEL_PASSWORD = "iZh4UYxVSo3S2H3XwwboM2z@mJEqYJkQ5yMTfd5p";
FILE__CF_TUNNEL_CONFIG = "/config/tunnelconfig.yml";
EMAIL = "cdombroski@gmail.com";
2024-04-25 20:43:21 -04:00
};
2024-09-05 19:08:29 -04:00
ports = [
"80:80"
"443:443"
];
2024-05-11 12:51:25 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
"--cap-add"
"NET_ADMIN"
"--network-alias=icanttype.org"
];
2024-04-25 20:43:21 -04:00
};
jellyfin = {
image = "lscr.io/linuxserver/jellyfin:latest";
2024-08-28 21:24:00 -04:00
volumes = [
"jellyfin-config:/config"
"/video-data/media:/data/media"
"jellyfin-tailscale:/var/lib/tailscale"
];
2024-08-19 16:41:12 -04:00
environment = {
2024-08-28 21:24:00 -04:00
DOCKER_MODS = "ghcr.io/tailscale-dev/docker-mod:main";
TAILSCALE_STATE_DIR = "/var/lib/tailscale";
TAILSCALE_HOSTNAME = "jellyfin";
TAILSCALE_SERVE_PORT = "8096";
TAILSCALE_SERVE_MODE = "http";
2024-08-19 16:41:12 -04:00
TZ = "America/New_York";
};
environmentFiles = [ config.sops.templates."docker.env".path ];
2024-04-25 20:43:21 -04:00
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
ports = [
"1900:1900/udp"
"7359:7359/udp"
];
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
zwave-js-ui = {
2024-08-20 21:49:04 -04:00
image = "my-zwave-js-ui:latest";
imageFile = pkgs.dockerTools.buildLayeredImage {
2024-08-20 21:49:04 -04:00
name = "my-zwave-js-ui";
tag = "latest";
2024-09-21 21:50:25 -04:00
contents = [ pkgs.cacert ];
2024-09-19 20:46:32 -04:00
config.Cmd = [ "${inputs.self.packages.${pkgs.stdenv.system}.zwave-js-ui}/bin/zwave-js-ui" ];
2024-08-20 21:49:04 -04:00
};
2024-04-25 20:43:21 -04:00
volumes = [ "zwave-config:/usr/src/app/store" ];
2024-08-20 21:49:04 -04:00
environment = {
TZ = "America/New_York";
STORE_DIR = "/usr/src/app/store";
ZWAVEJS_EXTERNAL_CONFIG = "/usr/src/app/store/.config-db";
};
2024-05-11 12:51:25 -04:00
labels = {
swag = "enable";
swag_url = "zwave.icanttype.org";
2024-08-20 21:49:04 -04:00
swag_port = "8091";
2024-05-11 12:51:25 -04:00
};
2024-09-05 19:08:29 -04:00
extraOptions = [
"--network=www"
"--device=/dev/ttyACM0:/dev/zwave"
];
2024-04-25 20:43:21 -04:00
};
homeassistant = {
image = "lscr.io/linuxserver/homeassistant:latest";
volumes = [ "homeassistant-config:/config" ];
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
"--network=lan"
];
2024-04-25 20:43:21 -04:00
};
postgres = {
image = "docker.io/library/postgres:15";
volumes = [ "postgres-15:/var/lib/postgresql/data" ];
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
calibre = {
image = "lscr.io/linuxserver/calibre:latest";
2024-09-05 19:08:29 -04:00
volumes = [
"calibre-config:/config"
"/video-data:/data"
];
2024-04-25 20:43:21 -04:00
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
calibre-web = {
image = "lscr.io/linuxserver/calibre-web:latest";
2024-09-05 19:08:29 -04:00
volumes = [
"calibre-web-config:/config"
"/video-data:/data"
];
2024-04-25 20:43:21 -04:00
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
flaresolverr = {
image = "ghcr.io/flaresolverr/flaresolverr:latest";
environment.LOG_LEVEL = "info";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
qbittorrent = {
image = "lscr.io/linuxserver/qbittorrent:latest";
2024-09-05 19:08:29 -04:00
volumes = [
"qbittorrent-config:/config"
"/video-data/torrent:/data/torrent"
];
2024-04-25 20:43:21 -04:00
environment = {
TZ = "America/New_York";
UMASK_SET = "000";
DELUGE_LOGLEVEL = "error";
};
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
ports = [
"34996:34996"
"34996:34996/udp"
];
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
prowlarr = {
image = "lscr.io/linuxserver/prowlarr:latest";
volumes = [ "prowlarr-config:/config" ];
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
readarr = {
image = "lscr.io/linuxserver/readarr:develop";
2024-09-05 19:08:29 -04:00
volumes = [
"readarr-config:/config"
"/video-data:/data"
];
2024-04-25 20:43:21 -04:00
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
radarr = {
image = "lscr.io/linuxserver/radarr:latest";
2024-09-05 19:08:29 -04:00
volumes = [
"radarr-config:/config"
"/video-data:/data"
];
2024-04-25 20:43:21 -04:00
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
sonarr = {
image = "lscr.io/linuxserver/sonarr:latest";
2024-09-05 19:08:29 -04:00
volumes = [
"sonarr-config:/config"
"/video-data:/data"
];
2024-04-25 20:43:21 -04:00
environment.TZ = "America/New_York";
labels.swag = "enable";
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
static = {
image = "docker.io/library/nginx:alpine";
2024-05-11 12:51:25 -04:00
volumes = [
"/srv/docker/nginx/static:/usr/share/nginx/html:ro"
"/srv/docker/nginx/config/static/default.conf:/etc/nginx/config.d/default.conf:ro"
];
2024-04-25 20:43:21 -04:00
labels = {
swag = "enable";
swag_url = "www.icanttype.org";
};
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
forgejo = {
2024-08-21 11:26:54 -04:00
image = "codeberg.org/forgejo/forgejo:8";
2024-09-05 19:08:29 -04:00
volumes = [
"forgejo-data:/data"
"/etc/localtime:/etc/localtime:ro"
];
2024-04-25 20:43:21 -04:00
labels = {
swag = "enable";
swag_url = "git.icanttype.org";
swag_port = "3000";
};
ports = [ "10022:22" ];
2024-09-05 19:08:29 -04:00
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
docker_dind = {
image = "docker.io/library/docker:dind";
2024-09-05 19:08:29 -04:00
cmd = [
"dockerd"
"-H"
"tcp://0.0.0.0:2375"
"--tls=false"
];
extraOptions = [
"--pull=newer"
"--privileged"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
runner = {
image = "code.forgejo.org/forgejo/runner:3.4.1";
dependsOn = [ "docker_dind" ];
environment.DOCKER_HOST = "tcp://docker_dind:2375";
volumes = [ "forgejo-runner:/data" ];
2024-09-05 19:08:29 -04:00
cmd = [
"forgejo-runner"
"daemon"
];
extraOptions = [
"--pull=newer"
"--network=www"
];
2024-04-25 20:43:21 -04:00
};
};
};
2024-04-27 22:10:36 -04:00
networking.firewall = {
interfaces."podman+" = {
allowedUDPPorts = [ 53 ];
allowedTCPPorts = [ 53 ];
};
2024-09-05 19:08:29 -04:00
allowedUDPPorts = [
137
138
];
allowedTCPPorts = [
139
445
];
2024-04-25 20:43:21 -04:00
};
2024-09-20 19:43:01 -04:00
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
2024-04-25 20:43:21 -04:00
users.users.nixremote = {
description = "User for remote builds";
isNormalUser = true;
uid = 1100;
2024-05-11 12:51:25 -04:00
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH7rvqA2VG9kOPHBNgfna0YA+jEjIR6ZAKrdgWVWQjCV root@orangepihole"
];
2024-04-25 20:43:21 -04:00
};
2024-09-20 19:43:01 -04:00
nix.settings.trusted-users = [ "nixremote" ];
2024-05-31 20:04:28 -04:00
environment = {
2024-09-21 21:50:25 -04:00
systemPackages = builtins.attrValues {
inherit (pkgs)
vim
dive
podman-tui
docker-compose
tcpdump
ethtool
;
inherit (pkgs-unstable) recyclarr;
};
2024-05-31 20:04:28 -04:00
persistence."/persist" = {
2024-08-21 21:11:53 -04:00
enableWarnings = false;
2024-05-31 20:04:28 -04:00
hideMounts = true;
2024-09-05 19:08:29 -04:00
directories = [
"/srv/docker"
"/tmp"
"/etc/containers/networks"
];
2024-05-31 20:04:28 -04:00
files = [
"/etc/machine-id"
"/etc/adjtime"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
2024-05-31 20:51:33 -04:00
];
2024-05-31 20:04:28 -04:00
};
};
2024-04-25 20:43:21 -04:00
2024-05-04 12:59:59 -04:00
services = {
samba = {
enable = true;
shares = {
media = {
path = "/video-data";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
};
};
};
avahi = {
enable = true;
2024-05-30 20:39:54 -04:00
nssmdns4 = true;
nssmdns6 = true;
2024-05-04 12:59:59 -04:00
openFirewall = true;
extraServiceFiles = {
smb = ''
2024-05-11 12:51:25 -04:00
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
</service-group>
2024-05-04 12:59:59 -04:00
'';
};
2024-04-27 16:18:43 -04:00
};
};
2024-04-25 20:43:21 -04:00
services.zfs.autoScrub.enable = true;
2024-04-26 18:09:44 -04:00
services.zfs.zed.settings = {
ZED_EMAIL_ADDR = [ "root" ];
ZED_EMAIL_PROG = "${pkgs.msmtp}/bin/msmtp";
ZED_EMAIL_OPTS = "@ADDRESS@";
ZED_NOTIFY_INTERVAL_SECS = 3600;
ZED_NOTIFY_VERBOSE = true;
ZED_USE_ENCLOSURE_LEDS = true;
ZED_SCRUB_AFTER_RESILVER = true;
};
services.zfs.zed.enableMail = false;
2024-04-25 20:43:21 -04:00
system.stateVersion = "23.11"; # Did you read the comment?
zramSwap.enable = true;
}