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
transmission: refactor preStart into script; add test #37329
Conversation
@@ -21,6 +21,16 @@ let | |||
|
|||
# for users in group "transmission" to have access to torrents | |||
fullSettings = { umask = 2; download-dir = downloadDir; incomplete-dir = incompleteDir; } // cfg.settings; | |||
|
|||
preStart = pkgs.writeScript "transmission-pre-start" '' | |||
#!${pkgs.runtimeShell} |
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.
Could you indent this? ''
strings will correctly remove the Nix indentation.
preStart = pkgs.writeScript "transmission-pre-start" '' | ||
#!${pkgs.runtimeShell} | ||
set -ex | ||
for DIR in ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir}; do |
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.
To make this future proof against overlong lines, the list of DIRs can be placed on separate lines :-)
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.
Good idea! Though I think I did one better (and easier actually): represent the list in nix. Reflect to shell.
Also added a test for even extra future proofing haha.
11300d3
to
7edab7c
Compare
Example of output from test, showing logging of pre-start commands. I'm a supporter of the verbose logging but not sure if it's standard.
|
ping. |
Some nitpicks:
|
7edab7c
to
ce03303
Compare
Updated. I'm curious: what's the reasoning behind "subject lines should not end with a dot"? |
It's just common practice. Similar to email subject lines and chapter titles in books. Also it saves one char :-) |
Motivation for this change
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)