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 = [ imports = [
./hardware.nix ./hardware.nix
./tor.nix
../../modules/base ../../modules/base
../../modules/tor ../../modules/tor
]; ];

View file

@ -1,6 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }: {
{
imports = imports =
[ [
(modulesPath + "/profiles/qemu-guest.nix") (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 = { services.tor = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
@ -8,9 +8,22 @@
}; };
settings = { settings = {
ContactInfo = "admin@caspervk.net"; ContactInfo = "admin@caspervk.net";
Nickname = "caspervk";
DirPort = 80; 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; ControlPort = 9051;
DirPortFrontPage = builtins.toFile "tor-exit-notice.html" (builtins.readFile ./tor-exit-notice.html); DirPortFrontPage = builtins.toFile "tor-exit-notice.html" (builtins.readFile ./tor-exit-notice.html);
ExitRelay = true; ExitRelay = true;
@ -23,7 +36,7 @@
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nyx # Command-line monitor for Tor nyx # Command-line monitor for Tor
]; ];
environment.persistence."/nix/persist" = { environment.persistence."/nix/persist" = {