System/machines/perception/configuration.nix

226 lines
6.3 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";
};
};
# 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
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_2;
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-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-04-09 00:29: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-04-10 12:01:04 -04:00
};
2023-04-08 23:20:43 -04:00
}