This commit is contained in:
Casper V. Kristensen 2023-08-06 22:08:38 +02:00
parent 9e8492e45c
commit 1d7fb9c59d
4 changed files with 27 additions and 10 deletions

View file

@ -1,8 +1,7 @@
{ ... }:
{
{ ... }: {
imports = [
./hardware.nix
./tor.nix
../../modules/base
../../modules/tor
];

View file

@ -1,6 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }:
{
{ config, lib, pkgs, modulesPath, ... }: {
imports =
[
(modulesPath + "/profiles/qemu-guest.nix")

7
hosts/tor/tor.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }: {
services.tor = {
settings = {
Nickname = "caspervk";
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ config, pkgs, ... }: {
services.tor = {
enable = true;
openFirewall = true;
@ -8,9 +8,22 @@
};
settings = {
ContactInfo = "admin@caspervk.net";
Nickname = "caspervk";
DirPort = 80;
ORPort = 443;
ORPort =
# TOR requires each IPv6 address to be configured explicity
let
interfaces = builtins.attrValues config.networking.interfaces;
ipv6Addresses = pkgs.lib.lists.flatten (map (interface: interface.ipv6.addresses) interfaces);
ipv6Ports = map
(a: {
addr = "[${a.address}]";
port = 443;
})
ipv6Addresses;
in
[
443
] ++ ipv6Ports;
ControlPort = 9051;
DirPortFrontPage = builtins.toFile "tor-exit-notice.html" (builtins.readFile ./tor-exit-notice.html);
ExitRelay = true;
@ -23,7 +36,7 @@
};
environment.systemPackages = with pkgs; [
nyx # Command-line monitor for Tor
nyx # Command-line monitor for Tor
];
environment.persistence."/nix/persist" = {