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

  • InnerScientist@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 day ago

    As far as I can see you don’t define any way to start Tor in nix but that is how nix normally passes along the tor config.
    ExecStart=/nix/store/<hash1>-tor-0.4.8.14/bin/tor -f /nix/store/<hash2>-torrc
    ExecStart=${pkgs.tor}/bin/tor -f ${localTorrcDefinition}

    You could define a file in etc that is your torrc, then point your service manager to use that as the -f argument for Tor.

    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)

    • 𝔗𝔢𝔯 𝔐𝔞𝔵𝔦𝔪𝔞OP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day 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)