Skip to content

Commit

Permalink
updated flake
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus-kirk committed Feb 21, 2024
1 parent cac2199 commit e53defe
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 32 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Nixarr

![Logo](./docs/img/logo-1.webp)

This is a nixos module that aims to make the installation and management of
running the "*Arrs" as easy, and pain free, as possible.

Expand Down
Binary file added docs/img/logo-1.webp
Binary file not shown.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
};

inputs = {
#nixpkgs.url = "github:nixos/nixpkgs/22.11";
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 = {
url = "github:hercules-ci/flake-parts";
Expand Down
5 changes: 1 addition & 4 deletions nixarr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ in {

config = mkIf cfg.enable {
users.groups = {
media = {
members = cfg.mediaUsers;
gid = 992;
};
media.gid = 992;
prowlarr = {};
transmission = {};
jellyfin = {};
Expand Down
26 changes: 12 additions & 14 deletions nixarr/jellyfin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = {
Expand All @@ -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."/" = {
Expand All @@ -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 = [
Expand Down
8 changes: 6 additions & 2 deletions nixarr/prowlarr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.";

Expand All @@ -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 = [
Expand All @@ -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 = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ in
};

users.users = mkIf (cfg.user == "prowlarr") {
sonarr = {
prowlarr = {
group = cfg.group;
home = cfg.dataDir;
uid = 293;
Expand Down

0 comments on commit e53defe

Please sign in to comment.