Skip to content

Commit d3f3d38

Browse files
committed
update documentation, remove dumb comments
1 parent f84ba9f commit d3f3d38

14 files changed

Lines changed: 6 additions & 68 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Generic NixOS Jellyfin media server configuration with the Arr stack (Sonarr, Ra
1111
- **Flexible Directory Management**: Configurable media and state directories with automatic setup
1212
- **Service Dependencies**: Configure custom systemd service dependencies
1313
- **Optional Nginx Reverse Proxy**: Configurable nginx integration for all services
14+
- [**TRaSH Guides**](trash-guides.info): Default configuration follows TRaSH guidelines
1415

1516
## Usage
1617

modules/arr-common/hostConfigModule.nix

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
with lib;
33
types.submodule {
44
options = {
5-
# Connection settings
65
bindAddress = mkOption {
76
type = types.str;
87
default = "*";
@@ -26,7 +25,6 @@ with lib;
2625
description = "Enable SSL";
2726
};
2827

29-
# Authentication settings
3028
authenticationMethod = mkOption {
3129
type = types.enum ["none" "basic" "forms" "external"];
3230
default = "forms";
@@ -51,7 +49,6 @@ with lib;
5149
description = "Path to password secret file";
5250
};
5351

54-
# URL settings
5552
urlBase = mkOption {
5653
type = types.str;
5754
default = "";
@@ -69,7 +66,6 @@ with lib;
6966
description = "Instance name";
7067
};
7168

72-
# Logging settings
7369
logLevel = mkOption {
7470
type = types.enum ["info" "debug" "trace"];
7571
default = "info";
@@ -88,7 +84,6 @@ with lib;
8884
description = "Console log level";
8985
};
9086

91-
# Update settings
9287
branch = mkOption {
9388
type = types.str;
9489
description = "Update branch";
@@ -112,7 +107,6 @@ with lib;
112107
description = "Update script path";
113108
};
114109

115-
# Proxy settings
116110
proxyEnabled = mkOption {
117111
type = types.bool;
118112
default = false;
@@ -161,7 +155,6 @@ with lib;
161155
description = "Proxy bypass local addresses";
162156
};
163157

164-
# SSL settings
165158
sslCertPath = mkOption {
166159
type = types.str;
167160
default = "";
@@ -180,7 +173,6 @@ with lib;
180173
description = "Certificate validation";
181174
};
182175

183-
# Backup settings
184176
backupFolder = mkOption {
185177
type = types.str;
186178
default = "Backups";
@@ -199,7 +191,6 @@ with lib;
199191
description = "Backup retention in days";
200192
};
201193

202-
# Other settings
203194
launchBrowser = mkOption {
204195
type = types.bool;
205196
default = false;

modules/arr-common/hostConfigService.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
lib,
33
pkgs,
4-
}:
5-
# Helper function to create a systemd service that configures *arr basic settings via API
6-
serviceName: serviceConfig:
4+
}: serviceName: serviceConfig:
75
with lib; let
86
mkWaitForApiScript = import ./mkWaitForApiScript.nix {inherit lib pkgs;};
97
capitalizedName = lib.toUpper (builtins.substring 0 1 serviceName) + builtins.substring 1 (-1) serviceName;

modules/arr-common/mkArrServiceModule.nix

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ in {
245245

246246
systemd.services =
247247
{
248-
# Service that waits for PostgreSQL database role to be ready
249248
"${serviceName}-wait-for-db" = mkIf config.services.postgresql.enable {
250249
description = "Wait for ${capitalizedName} PostgreSQL database role to be ready";
251250
after = ["postgresql.service" "postgresql-setup.service"];
@@ -272,8 +271,6 @@ in {
272271
'';
273272
};
274273

275-
# Ensure main service (radarr.service, etc.) starts after
276-
# directories are created and configured dependencies
277274
${serviceName} = {
278275
after =
279276
["nixflix-setup-dirs.service"]
@@ -286,10 +283,8 @@ in {
286283
++ (optional config.services.postgresql.enable "postgresql-ready.target");
287284
wants = optional config.nixflix.mullvad.enable "mullvad-config.service";
288285

289-
# Always use static users and configure VPN bypass
290286
serviceConfig =
291287
{
292-
# DynamicUser causes issues with VPN bypass and permissions
293288
DynamicUser = mkForce false;
294289
User = cfg.user;
295290
Group = cfg.group;
@@ -298,21 +293,16 @@ in {
298293
EnvironmentFile = "/run/${serviceName}/env";
299294
}
300295
// optionalAttrs (config.nixflix.mullvad.enable && !cfg.vpn.enable) {
301-
# Bypass VPN by wrapping with mullvad-exclude
302296
ExecStart = mkForce (pkgs.writeShellScript "${serviceName}-vpn-bypass" ''
303297
exec /run/wrappers/bin/mullvad-exclude ${getExe config.services.${serviceName}.package} \
304298
-nobrowser -data='${stateDir}'
305299
'');
306-
# mullvad-exclude needs CAP_SYS_ADMIN to manipulate cgroups
307300
AmbientCapabilities = "CAP_SYS_ADMIN";
308-
# Delegate allows the service to manage its cgroup subtree
309301
Delegate = mkForce true;
310302
};
311303
};
312304
}
313-
# Only create config and rootfolders services if apiKeyPath is configured
314305
// optionalAttrs (cfg.config.apiKeyPath != null && cfg.config.hostConfig.passwordPath != null) {
315-
# Create environment file setup service
316306
"${serviceName}-env" = {
317307
description = "Setup ${capitalizedName} environment file";
318308
wantedBy = ["${serviceName}.service"];
@@ -333,14 +323,11 @@ in {
333323
'';
334324
};
335325

336-
# Configure service via API
337326
"${serviceName}-config" = mkArrHostConfigService serviceName cfg.config;
338327
}
339-
# Only create root folders service if rootFolders is not empty
340328
// optionalAttrs (usesMediaDirs && cfg.config.apiKeyPath != null && cfg.config.rootFolders != []) {
341329
"${serviceName}-rootfolders" = mkArrRootFoldersService serviceName cfg.config;
342330
}
343-
# Only create download clients service if downloadClients is not empty
344331
// optionalAttrs (cfg.config.apiKeyPath != null) {
345332
"${serviceName}-downloadclients" = mkArrDownloadClientsService serviceName cfg.config;
346333
};

modules/arr-common/mkWaitForApiScript.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
lib,
33
pkgs,
4-
}:
5-
# Helper function to create a script that waits for an *arr service API to be ready
6-
serviceName: serviceConfig:
4+
}: serviceName: serviceConfig:
75
pkgs.writeShellScript "${serviceName}-wait-for-api" (let
86
capitalizedName = lib.toUpper (builtins.substring 0 1 serviceName) + builtins.substring 1 (-1) serviceName;
97
in ''

modules/arr-common/rootFoldersService.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
lib,
33
pkgs,
4-
}:
5-
# Helper function to create a systemd service that configures *arr root folders via API
6-
serviceName: serviceConfig:
4+
}: serviceName: serviceConfig:
75
with lib; let
86
mkWaitForApiScript = import ./mkWaitForApiScript.nix {inherit lib pkgs;};
97
capitalizedName = lib.toUpper (builtins.substring 0 1 serviceName) + builtins.substring 1 (-1) serviceName;
@@ -51,9 +49,7 @@ in {
5149
done
5250
5351
${concatMapStringsSep "\n" (folderConfig: let
54-
# Convert the Nix attr set to a JSON string
5552
folderJson = builtins.toJSON folderConfig;
56-
# Extract the path for checking existence
5753
folderPath = folderConfig.path;
5854
in ''
5955
if ! echo "$ROOT_FOLDERS" | ${pkgs.jq}/bin/jq -e '.[] | select(.path == "${folderPath}")' >/dev/null 2>&1; then

modules/mullvad.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ in {
129129
''}
130130
'';
131131
ExecStop = pkgs.writeShellScript "logout-mullvad" ''
132-
# Get device name and revoke it
133132
DEVICE_NAME=$(${mullvadPkg}/bin/mullvad account get | grep "Device name:" | sed 's/.*Device name:[[:space:]]*//')
134133
if [ -n "$DEVICE_NAME" ]; then
135134
echo "Revoking device: $DEVICE_NAME"

modules/nixflix.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ in {
141141
config = mkIf cfg.enable {
142142
users.groups.media.members = cfg.mediaUsers;
143143

144-
# Create directories for all enabled services after dependencies are met
145144
systemd.services.nixflix-setup-dirs = {
146145
description = "Create directories for nixflix media server services";
147146
wantedBy = ["multi-user.target"];
@@ -154,7 +153,6 @@ in {
154153
};
155154

156155
script = ''
157-
# Base directories
158156
${pkgs.coreutils}/bin/mkdir -p ${cfg.stateDir}
159157
${pkgs.coreutils}/bin/chown root:root ${cfg.stateDir}
160158
${pkgs.coreutils}/bin/chmod 0755 ${cfg.stateDir}
@@ -167,7 +165,6 @@ in {
167165
${pkgs.coreutils}/bin/chown ${globals.libraryOwner.user}:${globals.libraryOwner.group} ${cfg.downloadsDir}
168166
${pkgs.coreutils}/bin/chmod 0775 ${cfg.downloadsDir}
169167
170-
# Service-registered directories
171168
${concatMapStringsSep "\n" (reg: ''
172169
${pkgs.coreutils}/bin/mkdir -p ${reg.dir}
173170
${pkgs.coreutils}/bin/chown ${reg.owner}:${reg.group} ${reg.dir}

modules/postgres.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ in {
1919
};
2020

2121
config = mkIf (nixflix.enable && cfg.enable) {
22-
# Register directories to be created
2322
nixflix.dirRegistrations = [
2423
{
2524
dir = stateDir;

modules/prowlarr/applicationsService.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
lib,
33
pkgs,
4-
}:
5-
# Helper function to create a systemd service that configures Prowlarr applications via API
6-
serviceName: serviceConfig:
4+
}: serviceName: serviceConfig:
75
with lib; let
86
mkWaitForApiScript = import ../arr-common/mkWaitForApiScript.nix {inherit lib pkgs;};
97
capitalizedName = lib.toUpper (builtins.substring 0 1 serviceName) + builtins.substring 1 (-1) serviceName;

0 commit comments

Comments
 (0)