New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement aria2 service for controlling a daemon via rpc. #25181
Conversation
@indiscipline, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ehmry, @edolstra and @joachifm to be potential reviewers. |
Ping @LnL7, @jgeerds, @rasendubi (previously merged aria2-related PRs). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superficially looks good except some minor comments.
nixos/modules/misc/ids.nix
Outdated
@@ -547,6 +548,7 @@ | |||
#rpc = 271; # unused | |||
#geoip = 272; # unused | |||
fcron = 273; | |||
aria2 = 274; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
accessible to users in the "aria2" group. | ||
''; | ||
}; | ||
openPorts = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Services should not open firewall ports. (The only exception is sshd.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad. Copied from some other service and did't give enough thought.
}; | ||
extraArguments = mkOption { | ||
type = types.string; | ||
example = "--rpc-secret=12345 --enable-rpc --rpc-listen-all"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rpc-secret
already has an option and --enable-rpc
is always added, so these should not go into extraArguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
Targets are downloaded to ${downloadDir} by default and are | ||
accessible to users in the "aria2" group. | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual indentation pattern for multi-line strings is next:
{
description = ''
blah-blah
'';
# ^ only two spaces here
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
wantedBy = [ "multi-user.target" ]; | ||
preStart = '' | ||
mkdir -m 0770 -p "${homeDir}" | ||
chown aria2:aria2 "${homeDir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation seems to be broken in preStart
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; | ||
User = "aria2"; | ||
Group = "aria2"; | ||
PermissionsStartOnly = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Is there anything else to be fixed before merge? |
Thanks for the contribution! |
Thanks for the review, @rasendubi. All went pretty smooth for a first PR. I'll try better next time, though. |
Motivation for this change
Implement aria2 systemd service for controlling a daemon instance via rpc. There's already a nix package for aria2, but no service unit. Aria2 can be controlled by a few freely-available web-uis via rpc calls.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)