1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-26 19:16:47 +03:00

Fix indentation. Fix openPorts option default to false.

This commit is contained in:
Kirill 2017-04-27 17:13:27 +03:00
parent 7a6738fefc
commit 31c4498a47
2 changed files with 24 additions and 26 deletions

View file

@ -548,7 +548,7 @@
#rpc = 271; # unused #rpc = 271; # unused
#geoip = 272; # unused #geoip = 272; # unused
fcron = 273; fcron = 273;
aria2 = 274; aria2 = 274;
# When adding a gid, make sure it doesn't match an existing # When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal # uid. Users and groups with the same name should have equal

View file

@ -36,30 +36,29 @@ in
Targets are downloaded to ${downloadDir} by default and are Targets are downloaded to ${downloadDir} by default and are
accessible to users in the "aria2" group. accessible to users in the "aria2" group.
''; '';
}; };
openPorts = mkOption { openPorts = mkOption {
type = types.bool; type = types.bool;
default = true; default = false;
description = '' description = ''
Open the ports in the firewall. Defaults are: Open listen and RPC ports found in listenPortRange and rpcListenPort
- UDP 6881-6999 for transfers options in the firewall.
- TCP 6800 for RPC '';
'';
}; };
downloadDir = mkOption { downloadDir = mkOption {
type = types.string; type = types.string;
default = "${downloadDir}"; default = "${downloadDir}";
description = '' description = ''
Directory to store downloaded files. Directory to store downloaded files.
''; '';
}; };
listenPortRange = mkOption { listenPortRange = mkOption {
type = types.listOf types.attrs; type = types.listOf types.attrs;
default = [ { from = 6881; to = 6999; } ]; default = [ { from = 6881; to = 6999; } ];
description = '' description = ''
Set UDP listening port range used by DHT(IPv4, IPv6) and UDP tracker. Set UDP listening port range used by DHT(IPv4, IPv6) and UDP tracker.
''; '';
}; };
rpcListenPort = mkOption { rpcListenPort = mkOption {
type = types.int; type = types.int;
@ -72,15 +71,15 @@ in
description = '' description = ''
Set RPC secret authorization token. Set RPC secret authorization token.
Read https://aria2.github.io/manual/en/html/aria2c.html#rpc-auth to know how this option value is used. Read https://aria2.github.io/manual/en/html/aria2c.html#rpc-auth to know how this option value is used.
''; '';
}; };
extraArguments = mkOption { extraArguments = mkOption {
type = types.string; type = types.string;
example = "--rpc-secret=12345 --enable-rpc --rpc-listen-all"; example = "--rpc-listen-all --remote-time=true";
default = ""; default = "";
description = '' description = ''
Additional arguments to be passed to Aria2. Additional arguments to be passed to Aria2.
''; '';
}; };
}; };
}; };
@ -109,17 +108,17 @@ in
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
preStart = '' preStart = ''
mkdir -m 0770 -p "${homeDir}" mkdir -m 0770 -p "${homeDir}"
chown aria2:aria2 "${homeDir}" chown aria2:aria2 "${homeDir}"
if [[ ! -d "${config.services.aria2.downloadDir}" ]] if [[ ! -d "${config.services.aria2.downloadDir}" ]]
then then
mkdir -m 0770 -p "${config.services.aria2.downloadDir}" mkdir -m 0770 -p "${config.services.aria2.downloadDir}"
chown aria2:aria2 "${config.services.aria2.downloadDir}" chown aria2:aria2 "${config.services.aria2.downloadDir}"
fi fi
if [[ ! -e "${sessionFile}" ]] if [[ ! -e "${sessionFile}" ]]
then then
touch "${sessionFile}" touch "${sessionFile}"
chown aria2:aria2 "${sessionFile}" chown aria2:aria2 "${sessionFile}"
fi fi
cp -f "${settingsFile}" "${settingsDir}/aria2.conf" cp -f "${settingsFile}" "${settingsDir}/aria2.conf"
''; '';
@ -129,9 +128,8 @@ in
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
User = "aria2"; User = "aria2";
Group = "aria2"; Group = "aria2";
PermissionsStartOnly = true; PermissionsStartOnly = true;
}; };
}; };
}; };
} }