nixos/modules/tor/default.nix

33 lines
757 B
Nix
Raw Normal View History

2023-08-06 22:08:38 +02:00
{ config, pkgs, ... }: {
2023-08-06 00:45:08 +02:00
services.tor = {
enable = true;
openFirewall = true;
relay = {
enable = true;
role = "exit";
};
settings = {
ContactInfo = "admin@caspervk.net";
2023-08-11 17:43:23 +02:00
ControlPort = 9051; # for nyx
2023-08-06 00:45:08 +02:00
DirPort = 80;
DirPortFrontPage = builtins.toFile "tor-exit-notice.html" (builtins.readFile ./tor-exit-notice.html);
ExitRelay = true;
2023-08-11 17:43:23 +02:00
IPv6Exit = true;
2023-08-06 00:45:08 +02:00
ExitPolicy = [
"reject *:25"
"accept *:*"
];
};
};
environment.systemPackages = with pkgs; [
2023-08-06 22:08:38 +02:00
nyx # Command-line monitor for Tor
2023-08-06 00:45:08 +02:00
];
environment.persistence."/nix/persist" = {
directories = [
2023-08-11 17:43:23 +02:00
{ directory = "/var/lib/tor"; user = "tor"; group = "tor"; mode = "0700"; }
2023-08-06 00:45:08 +02:00
];
};
}