updated flake

This commit is contained in:
rasmus-kirk
2024-02-21 15:00:32 +01:00
parent cac2199e19
commit aa7feed256
9 changed files with 30 additions and 34 deletions
+2
View File
@@ -1,5 +1,7 @@
# Nixarr # Nixarr
![Logo](./docs/img/logo-1.webp)
This is a nixos module that aims to make the installation and management of This is a nixos module that aims to make the installation and management of
running the "*Arrs" as easy, and pain free, as possible. running the "*Arrs" as easy, and pain free, as possible.
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Generated
+6 -6
View File
@@ -79,11 +79,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1708294481, "lastModified": 1708451036,
"narHash": "sha256-DZtxmeb4OR7iCaKUUuq05ADV2rX8WReZEF7Tq//W0+Y=", "narHash": "sha256-tgZ38NummEdnXvxj4D0StHBzXgceAw8CptytHljH790=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a54e05bc12d88ff2df941d0dc1183cb5235fa438", "rev": "517601b37c6d495274454f63c5a483c8e3ca6be1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -126,11 +126,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1708407374, "lastModified": 1708501555,
"narHash": "sha256-EECzarm+uqnNDCwaGg/ppXCO11qibZ1iigORShkkDf0=", "narHash": "sha256-zJaF0RkdIPbh8LTmnpW/E7tZYpqIE+MePzlWwUNob4c=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f33dd27a47ebdf11dc8a5eb05e7c8fbdaf89e73f", "rev": "b50a77c03d640716296021ad58950b1bb0345799",
"type": "github" "type": "github"
}, },
"original": { "original": {
-5
View File
@@ -7,12 +7,7 @@
}; };
inputs = { inputs = {
#nixpkgs.url = "github:nixos/nixpkgs/22.11";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-flood.url = "github:3JlOy-PYCCKUi/nixpkgs/flood-module";
#nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
flake-parts = { flake-parts = {
url = "github:hercules-ci/flake-parts"; url = "github:hercules-ci/flake-parts";
+1 -4
View File
@@ -115,10 +115,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
users.groups = { users.groups = {
media = { media.gid = 992;
members = cfg.mediaUsers;
gid = 992;
};
prowlarr = {}; prowlarr = {};
transmission = {}; transmission = {};
jellyfin = {}; jellyfin = {};
+12 -14
View File
@@ -25,14 +25,12 @@ in {
expose = { expose = {
enable = mkEnableOption '' 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 { upnp.enable = mkEnableOption ''
type = types.bool; Use UPNP to try to open ports 80 and 443 on your router.
default = false; '';
description = "Use UPNP to try to open ports 80 and 443 on your router.";
};
domainName = mkOption { domainName = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
@@ -50,8 +48,8 @@ in {
config = config =
# TODO: this doesn't work. I don't know why :( # 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.vpn.enable && cfg.expose.enable)) || abort "vpn.enable not compatible with expose.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.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 mkIf cfg.enable
{ {
services.jellyfin = { services.jellyfin = {
@@ -62,23 +60,23 @@ in {
configDir = "${cfg.stateDir}/config"; configDir = "${cfg.stateDir}/config";
}; };
networking.firewall = mkIf cfg.nginx.enable { networking.firewall = mkIf cfg.expose.enable {
allowedTCPPorts = [ 80 443 ]; allowedTCPPorts = [ 80 443 ];
}; };
util.upnp = mkIf cfg.nginx.upnp.enable { util.upnp = mkIf cfg.expose.upnp.enable {
enable = true; enable = true;
openTcpPorts = [ 80 443 ]; openTcpPorts = [ 80 443 ];
}; };
services.nginx = mkIf (cfg.nginx.enable || cfg.vpn.enable) { services.nginx = mkIf (cfg.expose.enable || cfg.vpn.enable) {
enable = true; enable = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedGzipSettings = 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; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
@@ -103,9 +101,9 @@ in {
}; };
}; };
security.acme = mkIf cfg.nginx.enable { security.acme = mkIf cfg.expose.enable {
acceptTerms = true; acceptTerms = true;
defaults.email = cfg.nginx.acmeMail; defaults.email = cfg.expose.acmeMail;
}; };
util.vpnnamespace.portMappings = [ util.vpnnamespace.portMappings = [
+6 -2
View File
@@ -11,6 +11,10 @@ with lib; let
nixarr = config.nixarr; nixarr = config.nixarr;
cfg = config.nixarr.prowlarr; cfg = config.nixarr.prowlarr;
in { in {
imports = [
./prowlarr-module
];
options.nixarr.prowlarr = { options.nixarr.prowlarr = {
enable = mkEnableOption "Enable the Prowlarr service."; enable = mkEnableOption "Enable the Prowlarr service.";
@@ -29,7 +33,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
util.services.prowlarr = mkIf (!cfg.vpn.enable) { util.services.prowlarr = mkIf (!cfg.vpn.enable) {
enable = true; enable = true;
dataDir = cfg.statedir; dataDir = cfg.stateDir;
}; };
util.vpnnamespace.portMappings = [ util.vpnnamespace.portMappings = [
@@ -45,7 +49,7 @@ in {
autoStart = true; autoStart = true;
ephemeral = true; ephemeral = true;
extraFlags = ["--network-namespace-path=/var/run/netns/wg"]; extraFlags = ["--network-namespace-path=/var/run/netns/wg"];
bindMounts."${cfg.statedir}".isReadOnly = false; bindMounts."${cfg.stateDir}".isReadOnly = false;
config = { config = {
users.groups.prowlarr = {}; users.groups.prowlarr = {};
@@ -62,7 +62,7 @@ in
}; };
users.users = mkIf (cfg.user == "prowlarr") { users.users = mkIf (cfg.user == "prowlarr") {
sonarr = { prowlarr = {
group = cfg.group; group = cfg.group;
home = cfg.dataDir; home = cfg.dataDir;
uid = 293; uid = 293;
+2 -2
View File
@@ -69,7 +69,7 @@ in {
# TODO: This doesn't work, and it should... # TODO: This doesn't work, and it should...
#home = cfg.stateDir; #home = cfg.stateDir;
webHome = webHome =
if cfg.useFlood if cfg.flood.enable
then pkgs.flood-for-transmission then pkgs.flood-for-transmission
else null; else null;
package = pkgs.transmission_4; package = pkgs.transmission_4;
@@ -158,7 +158,7 @@ in {
# This is maybe wrong, too afraid to fix it lol # This is maybe wrong, too afraid to fix it lol
group = "media"; group = "media";
webHome = webHome =
if cfg.useFlood if cfg.flood.enable
then pkgs.flood-for-transmission then pkgs.flood-for-transmission
else null; else null;
package = pkgs.transmission_4; package = pkgs.transmission_4;