Skip to content

Commit 4101117

Browse files
authored
normalize documentation (#16)
1 parent dc16671 commit 4101117

8 files changed

Lines changed: 68 additions & 0 deletions

File tree

modules/arr-common/downloadClients.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ in {
3232
};
3333
});
3434
default = [];
35+
defaultText = literalExpression ''
36+
lib.optionals (config.nixflix.sabnzbd.enable or false) [
37+
{
38+
name = "SABnzbd";
39+
implementationName = "SABnzbd";
40+
apiKeyPath = config.nixflix.sabnzbd.apiKeyPath;
41+
host = config.nixflix.sabnzbd.settings.host;
42+
port = config.nixflix.sabnzbd.settings.port;
43+
urlBase = config.nixflix.sabnzbd.settings.url_base;
44+
}
45+
]
46+
'';
3547
description = ''
3648
List of download clients to configure via the API /downloadclient endpoint.
3749
Any additional attributes beyond name, implementationName, and apiKeyPath

modules/arr-common/hostConfigType.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ with lib;
5252
urlBase = mkOption {
5353
type = types.str;
5454
default = "";
55+
defaultText = literalExpression ''if config.nixflix.serviceNameIsUrlBase then "/<serviceName>" else ""'';
5556
description = "URL base path";
5657
};
5758

modules/arr-common/mkArrServiceModule.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ with lib; let
5353
};
5454
};
5555
};
56+
defaultText = lib.literalExpression ''
57+
{
58+
auth = {
59+
required = "Enabled";
60+
method = "Forms";
61+
};
62+
server = {
63+
inherit (config.nixflix.${serviceName}.config.hostConfig) port urlBase;
64+
};
65+
} // lib.optionalAttrs config.services.postgresql.enable {
66+
log.dbEnabled = true;
67+
postgres = {
68+
user = config.nixflix.${serviceName}.user;
69+
host = "/run/postgresql";
70+
port = 5432;
71+
mainDb = config.nixflix.${serviceName}.user;
72+
logDb = config.nixflix.${serviceName}.user;
73+
};
74+
}
75+
'';
5676
example = lib.options.literalExpression ''
5777
{
5878
update.mechanism = "internal";
@@ -160,6 +180,7 @@ in {
160180
mediaDirs = mkOption {
161181
type = types.listOf types.path;
162182
default = [];
183+
defaultText = literalExpression ''[config.nixflix.mediaDir + "/<media-type>"]'';
163184
description = "List of media directories to create and manage";
164185
};
165186
};

modules/arr-common/rootFolders.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ in {
1010
options = mkOption {
1111
type = types.listOf types.attrs;
1212
default = [];
13+
defaultText = literalExpression ''map (mediaDir: {path = mediaDir;}) config.nixflix.<serviceName>.mediaDirs'';
1314
description = ''
1415
List of root folders to create via the API /rootfolder endpoint.
1516
Each folder is an attribute set that will be converted to JSON and sent to the API.

modules/mullvad.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ in {
4545
"8.8.8.8"
4646
"8.8.4.4"
4747
];
48+
defaultText = literalExpression ''["1.1.1.1" "1.0.0.1" "8.8.8.8" "8.8.4.4"]'';
4849
example = ["194.242.2.4" "194.242.2.3"];
4950
description = ''
5051
DNS servers to use with the VPN.

modules/prowlarr/applications.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ in {
2626
};
2727
});
2828
default = [];
29+
defaultText = literalExpression ''
30+
# Automatically configured for enabled arr services (Sonarr, Radarr, Lidarr)
31+
# Each enabled service gets an application entry with computed baseUrl and prowlarrUrl
32+
# based on nginx configuration
33+
'';
2934
description = ''
3035
List of applications to configure in Prowlarr.
3136
Any additional attributes beyond name, implementationName, and apiKeyPath

modules/sabnzbd/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ in {
3636
group = mkOption {
3737
type = types.str;
3838
default = globals.libraryOwner.group;
39+
defaultText = literalExpression "config.nixflix.globals.libraryOwner.group";
3940
description = "Group under which the service runs";
4041
};
4142

4243
downloadsDir = mkOption {
4344
type = types.str;
4445
default = "${nixflix.downloadsDir}/usenet";
46+
defaultText = literalExpression ''config.nixflix.downloadsDir + "/usenet"'';
4547
description = "Base directory for SABnzbd downloads";
4648
};
4749

modules/sabnzbd/settingsType.nix

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ in
116116
if nixflix.nginx.enable
117117
then "/sabnzbd"
118118
else "/";
119+
defaultText = lib.literalExpression ''if config.nixflix.nginx.enable then "/sabnzbd" else "/"'';
119120
description = "URL base path for the web interface";
120121
};
121122

@@ -158,18 +159,21 @@ in
158159
download_dir = mkOption {
159160
type = types.str;
160161
default = "${cfg.downloadsDir}/incomplete";
162+
defaultText = lib.literalExpression ''config.nixflix.sabnzbd.downloadsDir + "/incomplete"'';
161163
description = "Incomplete downloads directory";
162164
};
163165

164166
complete_dir = mkOption {
165167
type = types.str;
166168
default = "${cfg.downloadsDir}/complete";
169+
defaultText = lib.literalExpression ''config.nixflix.sabnzbd.downloadsDir + "/complete"'';
167170
description = "Complete downloads directory";
168171
};
169172

170173
dirscan_dir = mkOption {
171174
type = types.str;
172175
default = "${cfg.downloadsDir}/watch";
176+
defaultText = lib.literalExpression ''config.nixflix.sabnzbd.downloadsDir + "/watch"'';
173177
description = "Directory to watch for NZB files";
174178
};
175179

@@ -182,18 +186,21 @@ in
182186
nzb_backup_dir = mkOption {
183187
type = types.str;
184188
default = "${cfg.downloadsDir}/nzb-backup";
189+
defaultText = lib.literalExpression ''config.nixflix.sabnzbd.downloadsDir + "/nzb-backup"'';
185190
description = "NZB backup directory";
186191
};
187192

188193
admin_dir = mkOption {
189194
type = types.str;
190195
default = "${cfg.downloadsDir}/admin";
196+
defaultText = lib.literalExpression ''config.nixflix.sabnzbd.downloadsDir + "/admin"'';
191197
description = "Admin directory";
192198
};
193199

194200
log_dir = mkOption {
195201
type = types.str;
196202
default = "${cfg.downloadsDir}/logs";
203+
defaultText = lib.literalExpression ''config.nixflix.sabnzbd.downloadsDir + "/logs"'';
197204
description = "Log directory";
198205
};
199206

@@ -427,6 +434,24 @@ in
427434
script = "None";
428435
}
429436
];
437+
example = lib.literalExpression ''
438+
[
439+
{
440+
name = "movies";
441+
dir = "movies";
442+
priority = 0;
443+
pp = 3;
444+
script = "None";
445+
}
446+
{
447+
name = "tv";
448+
dir = "tv";
449+
priority = 0;
450+
pp = 3;
451+
script = "None";
452+
}
453+
]
454+
'';
430455
description = "Download categories";
431456
};
432457
};

0 commit comments

Comments
 (0)