Skip to content
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

nixos/tor: add tor hidden service options #28081

Merged
merged 5 commits into from Aug 11, 2017
Merged

Conversation

tnias
Copy link
Contributor

@tnias tnias commented Aug 9, 2017

Motivation for this change

Having to configure tor hidden services via the extraConfig did not look as nice in the configuration.
This change allows to configure hidden services more conveniently.

Things done

Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers.

Since all changes are only related to generating torrc files i tested it on my local machine.
I was able to generate valid torrc files and host hidden services using those.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This change allows to configure hidden services more conveniently.
Copy link
Member

@fpletz fpletz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but see my comments.

mkHiddenServicePort = hsport: let
trgt = if (hsport.target != null) then
" " + hsport.target
else "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified like:

trgt = optionalString (hsport.target != null) (" " + hsport.target)

Copy link
Member

@Mic92 Mic92 Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following wins the golfing challenge:

trgt = '' ${hsport . target or ""}''

description = ''
Configure hidden services.

Please consult the tor manual (<literal>man tor</literal>) for a more
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rendered with docbook, so for referencing manpages you could use:

<citerefentry><refentrytitle>tor</refentrytitle><manvolnum>1</manvolnum></citerefentry>

Also use more elegant optionalString for optional strings.
@tnias
Copy link
Contributor Author

tnias commented Aug 11, 2017

This should do. I applied the docbook syntax to the previously existing documentation as well.

@Mic92 Mic92 merged commit b4d2cd6 into NixOS:master Aug 11, 2017
@oxij oxij mentioned this pull request Aug 17, 2017
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants