System/machines/perception/configuration.nix

274 lines
7.9 KiB
Nix
Raw Normal View History

2023-04-08 23:20:43 -04:00
{ config, lib, pkgs, inputs, ... }:
{
2023-04-08 23:57:42 -04:00
# Setup hardware
2023-04-09 00:41:21 -04:00
# imports = [ inputs.nixos-hardware.nixosModules.common-cpu-intel ];
2023-04-08 23:20:43 -04:00
# Sops setup for this machine
sops.secrets = {
"borg-ssh-key" = {
sopsFile = ../../secrets/perception/borg.yaml;
format = "yaml";
};
"borg-password" = {
sopsFile = ../../secrets/perception/borg.yaml;
format = "yaml";
};
2023-06-21 03:46:51 -04:00
"podgrab" = {
format = "binary";
sopsFile = ../../secrets/perception/podgrab;
mode = "0444";
};
2023-04-08 23:20:43 -04:00
};
# Setup system configuration
nathan = {
services = {
borg = {
enable = true;
2023-04-19 18:15:48 -04:00
extraExcludes = [ "/var/log" "/mnt" "/var/lib/tdarr" ];
2023-04-08 23:20:43 -04:00
passwordFile = config.sops.secrets."borg-password".path;
sshKey = config.sops.secrets."borg-ssh-key".path;
};
};
config = {
2023-04-08 23:36:46 -04:00
setupGrub = false;
2023-04-08 23:20:43 -04:00
nix = {
autoUpdate = true;
autoGC = true;
};
harden = false;
};
};
2023-04-08 23:36:46 -04:00
# Configure bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.kernelParams = [ "net.ifnames=0" ];
2023-04-08 23:20:43 -04:00
# Configure networking
networking = {
domain = "mccarty.io";
useDHCP = true;
# Open ports in firewall
firewall = {
allowedTCPPorts = [ ];
allowedUDPPorts = [ ];
};
};
# Setup home manager
home-manager.users.nathan = import ./home.nix;
2023-04-09 00:29:51 -04:00
## Media Streaming setup
2023-04-09 00:41:21 -04:00
# Setup hardware
2023-04-09 00:29:51 -04:00
hardware.opengl = {
enable = true;
driSupport = true;
2023-04-09 00:30:35 -04:00
driSupport32Bit = true;
2023-04-09 00:41:21 -04:00
extraPackages = with pkgs; [ libva vaapiIntel libvdpau-va-gl vaapiVdpau ];
};
# Newer kernel
2023-08-08 12:05:08 -04:00
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_4;
2023-04-10 14:55:54 -04:00
# Run plex and the like in containers, these applications get... a little fucky when run directly
# on nixos
2023-04-09 00:41:21 -04:00
virtualisation.oci-containers.containers = {
# Configure plex
"plex" = {
image = "lscr.io/linuxserver/plex:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
"VERSION" = "latest";
};
ports = [
"32400:32400"
"1900:1900"
"3005:3005"
"5353:5353"
"8324:8324"
"32410:32410"
"32412:32412"
"32413:32413"
"32414:32414"
"32469:32469"
];
2023-04-11 02:24:07 -04:00
volumes =
[ "/var/lib/plex:/config" "/mnt/plex:/media" "/mnt/music:/music" ];
2023-04-09 00:41:21 -04:00
extraOptions = [ "--device=/dev/dri:/dev/dri" ];
};
2023-04-11 01:47:13 -04:00
# Configure jellyfin
"jellyfin" = {
image = "lscr.io/linuxserver/jellyfin:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
"DOCKER_MODS" = "linuxserver/mods:jellyfin-opencl-intel";
};
ports = [ "8096:8096" "8920:8920" ];
2023-04-11 02:24:07 -04:00
volumes =
[ "/var/lib/jellyfin:/config" "/mnt/plex:/media" "/mnt/music:/music" ];
2023-04-11 01:47:13 -04:00
extraOptions = [ "--device=/dev/dri:/dev/dri" ];
};
2023-05-03 15:59:01 -04:00
# Configure jellyseerr - Requests for jellyfin
2023-05-03 15:39:48 -04:00
"jellyseerr" = {
image = "fallenbagel/jellyseerr:latest";
environment = { "TZ" = "America/New_York"; };
ports = [ "5055:5055" ];
volumes = [ "/var/lib/jellyseerr:/app/config" ];
};
2023-05-03 15:59:01 -04:00
# Configure wizarr - Account management for jellyfin
"wizarr" = {
image = "ghcr.io/wizarrrr/wizarr";
environment = {
"TZ" = "America/New_York";
"APP_URL" = "https://wizarr.mccarty.io";
"DISABLE_BUILTIN_AUTH" = "false";
};
ports = [ "5690:5690" ];
volumes = [ "/var/lib/wizarr:/data/database" ];
};
2023-04-22 23:57:15 -04:00
# Configure kavita
"kavita" = {
image = "kizaing/kavita:latest";
ports = [ "5000:5000" ];
volumes = [ "/var/lib/kavita:/kavita/config" "/mnt/books:/books" ];
};
2023-04-10 14:55:54 -04:00
# Configure tatulli - Plex Stats
2023-04-09 12:22:10 -04:00
"tautulli" = {
image = "lscr.io/linuxserver/tautulli:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
};
ports = [ "8181:8181" ];
volumes = [ "/var/lib/tautulli:/config" ];
2023-04-10 12:01:04 -04:00
dependsOn = [ "plex" ];
2023-04-09 12:22:10 -04:00
};
2023-04-10 14:55:54 -04:00
# Configure sabnzbd - Usenet
2023-04-09 18:39:48 -04:00
"sabnzbd" = {
image = "lscr.io/linuxserver/sabnzbd:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
2023-04-11 01:15:48 -04:00
"DOCKER_MODS" = "linuxserver/mods:sabnzbd-par2cmdline-turbo";
2023-04-09 18:39:48 -04:00
};
ports = [ "8080:8080" ];
volumes = [
"/var/lib/sabnzbd:/config"
"/mnt/scratch/sabnzbd/download-complete:/downloads"
"/mnt/scratch/sabnzbd/download:/incomplete-downloads"
];
};
2023-04-11 22:32:35 -04:00
# Configure tdarr - automatic transcoding and homogenization
"tdarr" = {
image = "ghcr.io/haveagitgat/tdarr";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
"internalNode" = "true";
"inContainer" = "true";
};
ports = [ "8265:8265" "8266:8266" "8267:8267" ];
2023-04-19 00:36:55 -04:00
volumes = [
"/var/lib/tdarr/configs:/app/configs"
"/var/lib/tdarr/server:/app/server"
"/var/lib/tdarr/logs:/app/logs"
"/var/lib/tdarr/cache:/app/cache"
"/mnt/plex:/media"
];
2023-04-11 22:32:35 -04:00
extraOptions = [ "--device=/dev/dri:/dev/dri" ];
};
2023-04-10 14:55:54 -04:00
# Configure sonarr - TV
2023-04-09 18:48:20 -04:00
"sonarr" = {
image = "lscr.io/linuxserver/sonarr:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
};
ports = [ "8989:8989" ];
volumes = [
"/var/lib/sonarr:/config"
"/mnt/plex:/media"
"/mnt/scratch/sabnzbd/download-complete:/downloads"
];
2023-04-10 12:01:04 -04:00
dependsOn = [ "sabnzbd" "plex" ];
2023-04-09 18:48:20 -04:00
};
2023-04-10 14:55:54 -04:00
# Configure radarr - Movies
2023-04-09 19:07:50 -04:00
"radarr" = {
image = "lscr.io/linuxserver/radarr:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
};
ports = [ "7878:7878" ];
volumes = [
"/var/lib/radarr:/config"
"/mnt/plex:/media"
"/mnt/scratch/sabnzbd/download-complete:/downloads"
];
2023-04-10 12:01:04 -04:00
dependsOn = [ "sabnzbd" "plex" ];
2023-04-09 19:07:50 -04:00
};
2023-04-10 14:55:54 -04:00
# Configure lidarr - Music
2023-04-10 12:15:35 -04:00
"lidarr" = {
image = "lscr.io/linuxserver/lidarr:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
};
ports = [ "8686:8686" ];
volumes = [
"/var/lib/lidarr:/config"
2023-04-10 12:18:14 -04:00
"/mnt/music:/music"
2023-04-10 12:15:35 -04:00
"/mnt/scratch/sabnzbd/download-complete:/downloads"
];
dependsOn = [ "sabnzbd" ];
};
2023-04-10 14:55:54 -04:00
# Configure bazarr - Subtitles
"bazarr" = {
image = "lscr.io/linuxserver/bazarr:latest";
environment = {
"PUID" = "1000";
"PGID" = "1000";
"TZ" = "America/New_York";
};
ports = [ "6767:6767" ];
volumes = [ "/var/lib/bazarr:/config" "/mnt/plex:/media" ];
dependsOn = [ "plex" ];
};
2023-06-21 04:03:55 -04:00
# Configure podgrab - podcasts
2023-06-21 23:04:27 -04:00
# "podgrab" = {
# image = "akhilrex/podgrab";
# environment = { "CHECK_FREQUENCY" = "5"; };
# volumes = [ "/var/lib/podgrab:/config" "/mnt/podcasts:/assets" ];
# ports = [ "4242:8080" ];
# };
# Configure audio bookshelf
"audiobookshelf" = {
image = "ghcr.io/advplyr/audiobookshelf:latest";
ports = [ "13378:80" ];
volumes = [
"/mnt/podcasts/audiobooks:/audiobooks"
"/mnt/podcasts/podcasts:/podcasts"
"/mnt/podcasts/metadata:/metadata"
"/var/lib/audiobookshelf:/config"
];
2023-06-21 04:03:55 -04:00
};
2023-06-21 03:46:51 -04:00
};
2023-04-10 12:01:04 -04:00
# Make the containers depend on their mounts
systemd.services = {
2023-04-19 00:36:55 -04:00
"podman-tdarr" = { after = [ "mnt-plex.mount" ]; };
2023-04-18 17:56:31 -04:00
"podman-plex" = { after = [ "mnt-music.mount" "mnt-plex.mount" ]; };
"podman-jellyfin" = { after = [ "mnt-music.mount" "mnt-plex.mount" ]; };
"podman-sabnzbd" = { after = [ "mnt-scratch.mount" ]; };
"podman-lidarr" = { after = [ "mnt-music.mount" ]; };
2023-06-21 23:04:27 -04:00
"podman-audiobookshelf" = { after = [ "mnt-podcasts.mount" ]; };
2023-04-10 12:01:04 -04:00
};
2023-04-08 23:20:43 -04:00
}