nixos-config/hosts/x86_64-linux/beleth/docker-compose-crime.nix

211 lines
5.1 KiB
Nix
Raw Permalink Normal View History

2024-07-06 16:42:49 +02:00
# Auto-generated using compose2nix v0.2.0-pre.
{
pkgs,
lib,
config,
inputs,
...
2024-07-07 19:47:12 +02:00
}: {
2024-07-06 16:42:49 +02:00
# Runtime
virtualisation.podman = {
enable = true;
autoPrune.enable = true;
dockerCompat = true;
defaultNetwork.settings = {
# Required for container networking to be able to use names.
dns_enabled = true;
};
};
virtualisation.oci-containers.backend = "podman";
# Containers
virtualisation.oci-containers.containers."crime-gluetun" = {
image = "qmcgaw/gluetun";
environment = {
SERVER_CITIES = "Frankfurt";
VPN_SERVICE_PROVIDER = "mullvad";
VPN_TYPE = "wireguard";
WIREGUARD_ADDRESSES = "10.71.178.75/32";
WIREGUARD_PRIVATE_KEY = "";
};
ports = [
"6881:6881/tcp"
"6881:6881/udp"
"8085:8085/tcp"
"7878:7878/tcp"
"8989:8989/tcp"
"9696:9696/tcp"
];
log-driver = "journald";
extraOptions = [
"--cap-add=NET_ADMIN"
"--network-alias=gluetun"
"--network=crime_default"
];
};
systemd.services."podman-crime-gluetun" = {
serviceConfig = {
Restart = lib.mkOverride 500 "\"no\"";
};
after = [
"podman-network-crime_default.service"
];
requires = [
"podman-network-crime_default.service"
];
partOf = [
"podman-compose-crime-root.target"
];
wantedBy = [
"podman-compose-crime-root.target"
];
};
virtualisation.oci-containers.containers."prowlarr" = {
image = "lscr.io/linuxserver/prowlarr:latest";
environment = {
PGID = "1000";
PUID = "1000";
TZ = "Etc/UTC";
};
volumes = [
"/home/crime/prowlarr/data:/config:rw"
];
dependsOn = [
"crime-gluetun"
];
log-driver = "journald";
extraOptions = [
"--network=container:crime-gluetun"
];
};
systemd.services."podman-prowlarr" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
partOf = [
"podman-compose-crime-root.target"
];
wantedBy = [
"podman-compose-crime-root.target"
];
};
virtualisation.oci-containers.containers."qbittorrent" = {
image = "lscr.io/linuxserver/qbittorrent";
environment = {
PGID = "1000";
PUID = "1000";
TZ = "Europe/Berlin";
WEBUI_PORT = "8085";
};
volumes = [
"/home/crime/qbittorrent:/config:rw"
"/home/crime/qbittorrent/downloads:/downloads:rw"
];
dependsOn = [
"crime-gluetun"
];
log-driver = "journald";
extraOptions = [
"--network=container:crime-gluetun"
];
};
systemd.services."podman-qbittorrent" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
partOf = [
"podman-compose-crime-root.target"
];
wantedBy = [
"podman-compose-crime-root.target"
];
};
virtualisation.oci-containers.containers."radarr" = {
image = "lscr.io/linuxserver/radarr:latest";
environment = {
PGID = "1000";
PUID = "1000";
TZ = "Etc/UTC";
};
volumes = [
"/home/crime/radarr/data:/config:rw"
"/home/crime/radarr/downloadclient-downloads:/downloads:rw"
"/home/crime/radarr/movies:/movies:rw"
];
dependsOn = [
"crime-gluetun"
];
log-driver = "journald";
extraOptions = [
"--network=container:crime-gluetun"
];
};
systemd.services."podman-radarr" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
partOf = [
"podman-compose-crime-root.target"
];
wantedBy = [
"podman-compose-crime-root.target"
];
};
virtualisation.oci-containers.containers."sonarr" = {
image = "lscr.io/linuxserver/sonarr:latest";
environment = {
PGID = "1000";
PUID = "1000";
TZ = "Etc/UTC";
};
volumes = [
"/home/crime/sonarr/data:/config:rw"
"/home/crime/sonarr/downloadclient-downloads:/downloads:rw"
"/home/crime/sonarr/tvseries:/tv:rw"
];
dependsOn = [
"crime-gluetun"
];
log-driver = "journald";
extraOptions = [
"--network=container:crime-gluetun"
];
};
systemd.services."podman-sonarr" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
partOf = [
"podman-compose-crime-root.target"
];
wantedBy = [
"podman-compose-crime-root.target"
];
};
# Networks
systemd.services."podman-network-crime_default" = {
path = [pkgs.podman];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "${pkgs.podman}/bin/podman network rm -f crime_default";
};
script = ''
podman network inspect crime_default || podman network create crime_default
'';
partOf = ["podman-compose-crime-root.target"];
wantedBy = ["podman-compose-crime-root.target"];
};
# Root service
# When started, this will automatically create all resources and start
# the containers. When stopped, this will teardown all resources.
systemd.targets."podman-compose-crime-root" = {
unitConfig = {
Description = "Root target generated by compose2nix.";
};
wantedBy = ["multi-user.target"];
};
}