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

tor: Add option to tor service for package #96686

Merged
merged 1 commit into from Aug 30, 2020

Conversation

nixy
Copy link
Contributor

@nixy nixy commented Aug 30, 2020

Motivation for this change

Currently the nixos module for running tor uses pkgs.tor to run the service. As a user I would like to be able to run the latest version of tor for my relay. I was able to accomplish this by overriding tor in nixpkgs like so:

  nixpkgs.config = {
    packageOverrides = pkgs: let self = pkgs; in with self; rec {
      tor = unstable.pkgs.tor;
    };
  };

But I would like to be able to not overwrite tor in this way and simply tell the service which package I want it to use. This is something many other modules allow. I could then replace the above with:

   services.tor = {
     enable = true;
     package = unstable.pkgs.tor;
   };
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

diff LGTM

cc @infinisil

@infinisil infinisil merged commit 6716867 into NixOS:master Aug 30, 2020
@kini
Copy link
Member

kini commented Feb 11, 2021

I think you missed one place where pkgs.tor is used:

    systemd.services.tor = {
      description = "Tor Daemon";
      path = [ pkgs.tor ];

Since everything in the systemd service definition is run from an absolute path, this probably isn't a bug as such, but I guess it does make the module depend on pkgs.tor even if the user has selected some other expression for the package. Is it worth making a PR to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants