updated flake
This commit is contained in:
+1
-4
@@ -115,10 +115,7 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.groups = {
|
||||
media = {
|
||||
members = cfg.mediaUsers;
|
||||
gid = 992;
|
||||
};
|
||||
media.gid = 992;
|
||||
prowlarr = {};
|
||||
transmission = {};
|
||||
jellyfin = {};
|
||||
|
||||
+12
-14
@@ -25,14 +25,12 @@ in {
|
||||
|
||||
expose = {
|
||||
enable = mkEnableOption ''
|
||||
Enable nginx for Jellyfin, exposing the web service to the internet.
|
||||
Enable expose for Jellyfin, exposing the web service to the internet.
|
||||
'';
|
||||
|
||||
upnp = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Use UPNP to try to open ports 80 and 443 on your router.";
|
||||
};
|
||||
upnp.enable = mkEnableOption ''
|
||||
Use UPNP to try to open ports 80 and 443 on your router.
|
||||
'';
|
||||
|
||||
domainName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
@@ -50,8 +48,8 @@ in {
|
||||
|
||||
config =
|
||||
# TODO: this doesn't work. I don't know why :(
|
||||
#assert (!(cfg.vpn.enable && cfg.nginx.enable)) || abort "vpn.enable not compatible with nginx.enable.";
|
||||
#assert (cfg.nginx.enable -> (cfg.nginx.domainName != null && cfg.nginx.acmeMail != null)) || abort "Both nginx.domain and nginx.acmeMail needs to be set if nginx.enable is set.";
|
||||
#assert (!(cfg.vpn.enable && cfg.expose.enable)) || abort "vpn.enable not compatible with expose.enable.";
|
||||
#assert (cfg.expose.enable -> (cfg.expose.domainName != null && cfg.expose.acmeMail != null)) || abort "Both expose.domain and expose.acmeMail needs to be set if expose.enable is set.";
|
||||
mkIf cfg.enable
|
||||
{
|
||||
services.jellyfin = {
|
||||
@@ -62,23 +60,23 @@ in {
|
||||
configDir = "${cfg.stateDir}/config";
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.nginx.enable {
|
||||
networking.firewall = mkIf cfg.expose.enable {
|
||||
allowedTCPPorts = [ 80 443 ];
|
||||
};
|
||||
|
||||
util.upnp = mkIf cfg.nginx.upnp.enable {
|
||||
util.upnp = mkIf cfg.expose.upnp.enable {
|
||||
enable = true;
|
||||
openTcpPorts = [ 80 443 ];
|
||||
};
|
||||
|
||||
services.nginx = mkIf (cfg.nginx.enable || cfg.vpn.enable) {
|
||||
services.nginx = mkIf (cfg.expose.enable || cfg.vpn.enable) {
|
||||
enable = true;
|
||||
|
||||
recommendedTlsSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
|
||||
virtualHosts."${builtins.replaceStrings ["\n"] [""] cfg.nginx.domainName}" = mkIf cfg.nginx.enable {
|
||||
virtualHosts."${builtins.replaceStrings ["\n"] [""] cfg.expose.domainName}" = mkIf cfg.expose.enable {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
@@ -103,9 +101,9 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
security.acme = mkIf cfg.nginx.enable {
|
||||
security.acme = mkIf cfg.expose.enable {
|
||||
acceptTerms = true;
|
||||
defaults.email = cfg.nginx.acmeMail;
|
||||
defaults.email = cfg.expose.acmeMail;
|
||||
};
|
||||
|
||||
util.vpnnamespace.portMappings = [
|
||||
|
||||
@@ -11,6 +11,10 @@ with lib; let
|
||||
nixarr = config.nixarr;
|
||||
cfg = config.nixarr.prowlarr;
|
||||
in {
|
||||
imports = [
|
||||
./prowlarr-module
|
||||
];
|
||||
|
||||
options.nixarr.prowlarr = {
|
||||
enable = mkEnableOption "Enable the Prowlarr service.";
|
||||
|
||||
@@ -29,7 +33,7 @@ in {
|
||||
config = mkIf cfg.enable {
|
||||
util.services.prowlarr = mkIf (!cfg.vpn.enable) {
|
||||
enable = true;
|
||||
dataDir = cfg.statedir;
|
||||
dataDir = cfg.stateDir;
|
||||
};
|
||||
|
||||
util.vpnnamespace.portMappings = [
|
||||
@@ -45,7 +49,7 @@ in {
|
||||
autoStart = true;
|
||||
ephemeral = true;
|
||||
extraFlags = ["--network-namespace-path=/var/run/netns/wg"];
|
||||
bindMounts."${cfg.statedir}".isReadOnly = false;
|
||||
bindMounts."${cfg.stateDir}".isReadOnly = false;
|
||||
|
||||
config = {
|
||||
users.groups.prowlarr = {};
|
||||
|
||||
@@ -62,7 +62,7 @@ in
|
||||
};
|
||||
|
||||
users.users = mkIf (cfg.user == "prowlarr") {
|
||||
sonarr = {
|
||||
prowlarr = {
|
||||
group = cfg.group;
|
||||
home = cfg.dataDir;
|
||||
uid = 293;
|
||||
@@ -69,7 +69,7 @@ in {
|
||||
# TODO: This doesn't work, and it should...
|
||||
#home = cfg.stateDir;
|
||||
webHome =
|
||||
if cfg.useFlood
|
||||
if cfg.flood.enable
|
||||
then pkgs.flood-for-transmission
|
||||
else null;
|
||||
package = pkgs.transmission_4;
|
||||
@@ -158,7 +158,7 @@ in {
|
||||
# This is maybe wrong, too afraid to fix it lol
|
||||
group = "media";
|
||||
webHome =
|
||||
if cfg.useFlood
|
||||
if cfg.flood.enable
|
||||
then pkgs.flood-for-transmission
|
||||
else null;
|
||||
package = pkgs.transmission_4;
|
||||
|
||||
Reference in New Issue
Block a user