I am attempting to configure the Tor daemon on nix-darwin. There is unfortunately no services.tor on this platform (yet ! maybe I’ll port it from nixOS once I know enough Nix to do that)

I could manage it with homebrew, however, that seems like a sub-par solution, effectively moving tor entirely out of the nix store.

I have installed the package in my flake, and I would like to link a torrc config file to the right directory /etc/tor. However, when done with environment.etc, the file is linked to the general /etc outside of the store, where tor cannot find it.

How can I link this file inside tor’s own /etc in the store, so it can use the configuration ?

Link to my config repo fixed at the current commit

  • 𝔗𝔢𝔯 𝔐𝔞𝔵𝔦𝔪𝔞@jlai.luOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 days ago

    I haven’t made it a service yet (it was going to be my next step), for now I was just starting it manually ! Your suggestion works (probably, not tested yet), but I was looking for a way to have the config loaded automatically even when running the tor command directly in a terminal (without any arguments)

    • InnerScientist@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 hours ago

      Another way would be to create a small derivation that copies the default tor derivation, overwrites the etc folder and then use that as your system Tor. (See runCommand)

      environment.systemPackages =
      let
        my-custom-tor = pkgs.runCommand "my-custom-tor" {} ''
                mkdir $out
                cp -r ${pkgs.tor}/* $out/
                chmod -R 755 $out
                echo "config" > $out/etc/tor/torrc
                ''
      in
      [
      ...
      my-custom-tor
      ...
      ]