nixfiles/nixos/boxes/colony/vms/shill/containers/jackflix/default.nix

158 lines
4.6 KiB
Nix
Raw Normal View History

{ lib, ... }:
let
2024-05-06 00:57:52 +01:00
inherit (lib) concatStringsSep;
inherit (lib.my) net;
2024-05-06 00:57:52 +01:00
inherit (lib.my.c) pubDomain;
2023-11-02 13:41:50 +00:00
inherit (lib.my.c.colony) domain prefixes;
in
{
nixos.systems.jackflix = { config, ... }: {
2022-06-11 19:13:20 +01:00
system = "x86_64-linux";
nixpkgs = "mine";
rendered = config.configuration.config.my.asContainer;
2022-06-11 19:13:20 +01:00
assignments = {
internal = {
name = "jackflix-ctr";
inherit domain;
ipv4.address = net.cidr.host 6 prefixes.ctrs.v4;
2022-06-11 19:13:20 +01:00
ipv6 = {
iid = "::6";
address = net.cidr.host 6 prefixes.ctrs.v6;
2022-06-11 19:13:20 +01:00
};
};
};
configuration = { lib, pkgs, config, ... }:
let
2023-11-13 20:49:59 +00:00
inherit (lib) mkForce;
2022-06-11 19:13:20 +01:00
in
{
imports = [ ./networking.nix ];
2022-06-12 14:03:44 +01:00
config = {
my = {
deploy.enable = false;
server.enable = true;
2022-06-11 19:13:20 +01:00
2022-06-12 14:03:44 +01:00
secrets = {
2022-06-19 01:23:18 +01:00
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPUv1ntVrZv5ripsKpcOAnyDQX2PHjowzyhqWK10Ml53";
2024-05-06 00:57:52 +01:00
files = {
"jackflix/photoprism-pass.txt" = {};
};
2022-06-11 19:13:20 +01:00
};
2022-06-12 14:03:44 +01:00
};
2022-06-12 01:40:57 +01:00
2023-11-13 20:49:59 +00:00
users = with lib.my.c.ids; {
2022-06-12 01:40:57 +01:00
users = {
2022-06-12 15:17:35 +01:00
"${config.my.user.config.name}".extraGroups = [ "media" ];
2022-06-12 14:03:44 +01:00
transmission.extraGroups = [ "media" ];
radarr.extraGroups = [ "media" ];
2022-06-12 15:17:35 +01:00
sonarr.extraGroups = [ "media" ];
2023-11-13 20:49:59 +00:00
jellyseerr = {
isSystemUser = true;
uid = uids.jellyseerr;
group = "jellyseerr";
};
2024-05-06 00:57:52 +01:00
photoprism = {
isSystemUser = true;
uid = uids.photoprism;
group = "photoprism";
};
2023-11-13 20:49:59 +00:00
};
groups = {
media.gid = 2000;
jellyseerr.gid = gids.jellyseerr;
2024-05-06 00:57:52 +01:00
photoprism.gid = gids.photoprism;
2022-06-12 01:40:57 +01:00
};
2022-06-12 14:03:44 +01:00
};
2022-06-12 01:40:57 +01:00
2022-06-12 14:03:44 +01:00
systemd = {
services = {
jackett.bindsTo = [ "systemd-networkd-wait-online@vpn.service" ];
transmission.bindsTo = [ "systemd-networkd-wait-online@vpn.service" ];
2022-06-12 14:03:44 +01:00
radarr.serviceConfig.UMask = "0002";
2022-06-12 15:17:35 +01:00
sonarr.serviceConfig.UMask = "0002";
2023-11-13 20:49:59 +00:00
jellyseerr.serviceConfig = {
# Needs to be able to read its secrets
DynamicUser = mkForce false;
User = "jellyseerr";
Group = "jellyseerr";
};
# https://github.com/NixOS/nixpkgs/issues/258793#issuecomment-1748168206
transmission.serviceConfig = {
RootDirectoryStartOnly = lib.mkForce false;
RootDirectory = lib.mkForce "";
};
2024-05-06 00:57:52 +01:00
photoprism.serviceConfig = {
# Needs to be able to access its data
DynamicUser = mkForce false;
};
2022-06-12 01:40:57 +01:00
};
2022-06-12 14:03:44 +01:00
};
2022-06-12 01:40:57 +01:00
2022-06-12 14:03:44 +01:00
services = {
2022-06-12 17:27:11 +01:00
netdata.enable = true;
2022-06-12 14:03:44 +01:00
transmission = {
enable = true;
downloadDirPermissions = null;
performanceNetParameters = true;
settings = {
download-dir = "/mnt/media/downloads/torrents";
incomplete-dir-enabled = true;
incomplete-dir = "/mnt/media/downloads/torrents/.incomplete";
umask = 002;
2022-06-12 02:40:57 +01:00
2022-06-12 14:03:44 +01:00
utp-enabled = true;
port-forwarding-enabled = false;
2022-06-12 02:40:57 +01:00
speed-limit-down = 28160;
speed-limit-down-enabled = true;
speed-limit-up = 28160;
speed-limit-up-enabled = true;
2022-06-12 14:03:44 +01:00
ratio-limit = 2.0;
ratio-limit-enabled = true;
2022-06-12 02:40:57 +01:00
2022-06-12 14:03:44 +01:00
rpc-bind-address = "::";
rpc-whitelist-enabled = false;
rpc-host-whitelist-enabled = false;
2022-06-12 01:40:57 +01:00
};
2022-06-11 19:13:20 +01:00
};
2022-06-12 14:03:44 +01:00
jackett.enable = true;
radarr.enable = true;
2022-06-12 15:17:35 +01:00
sonarr.enable = true;
2023-11-13 20:49:59 +00:00
jellyseerr = {
enable = true;
openFirewall = true;
};
2022-06-12 14:56:44 +01:00
jellyfin.enable = true;
2024-05-06 00:57:52 +01:00
photoprism = {
enable = true;
address = "[::]";
port = 2342;
originalsPath = "/mnt/media/photoprism/originals";
importPath = "/mnt/media/photoprism/import";
passwordFile = config.age.secrets."jackflix/photoprism-pass.txt".path;
settings = {
PHOTOPRISM_AUTH_MODE = "password";
PHOTOPRISM_ADMIN_USER = "dev";
PHOTOPRISM_APP_NAME = "/dev/player0 Photos";
PHOTOPRISM_SITE_URL = "https://photos.${pubDomain}/";
PHOTOPRISM_SITE_TITLE = "/dev/player0 Photos";
PHOTOPRISM_TRUSTED_PROXY = concatStringsSep "," (with prefixes.ctrs; [ v4 v6 ]);
PHOTOPRISM_DATABASE_DRIVER = "sqlite";
};
};
2022-06-12 14:03:44 +01:00
};
};
2022-06-11 19:13:20 +01:00
};
};
}