How to have Nixos download via tor?

I would like to prepare Nixos to update/download via tor so that i can still access the internet if things go sideways. I would just like to have it on standby in my configuration.nix so that i can switch to it if needed, not as my daily driver right now.

In configuration.nix i have

networking.proxy.default = "https://127.0.0.1:8118";
  
services.tor = {
    enable = true;
    client.enable = true;
    torsocks.enable = true;
};

Running sudo nixos-rebuild switch --upgrade works but i don’t know if it is actually using tor.

How do i test that and is there a better approach to my problem?

You may be able to set the networking proxy to a port that doesn’t have a proxy running on it, you should then see the fetchers fail.

However, it’s quite possible if it does fail it falls and avoids the proxy.

Good for a first test…

Actually, i did that unwittingly. When i said “it works” it only worked before the restart, thereafter the proxy setting apparently kicked in.

So i modified it to the following:

  networking.proxy.default = "https://127.0.0.1:8118";
  services.privoxy = {
    enable = true;
    enableTor = true;
  };
  services.tor = {
    enable = true;
    client.enable = true;
    torsocks.enable = true;
  };

This keeps working after restart. Apparently, the Nixos Wiki for Tor is not correct in this regard or i understood it wrong.

So i guess that the traffic is now rerouted but i’m still not sure…

1 Like