2024-04-07 02:35:53 +03:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
data = import ../../data.nix;
|
|
|
|
|
|
|
|
torBrowser = pkgs.tor-browser-bundle-bin.override {
|
|
|
|
mediaSupport = true;
|
|
|
|
pulseaudioSupport = true;
|
|
|
|
};
|
|
|
|
|
2024-04-07 02:45:20 +03:00
|
|
|
hostRunTorBrowser = pkgs.writeScriptBin "tor-browser" ''
|
2024-04-07 02:35:53 +03:00
|
|
|
${pkgs.socat}/bin/socat -d TCP-LISTEN:6000,fork,bind=192.168.7.10 UNIX-CONNECT:/tmp/.X11-unix/X0 &
|
|
|
|
${pkgs.xorg.xhost}/bin/xhost +
|
2024-04-07 02:45:20 +03:00
|
|
|
ssh -X browser@192.168.7.11 tor-browser
|
|
|
|
${pkgs.xorg.xhost}/bin/xhost -
|
2024-04-07 02:35:53 +03:00
|
|
|
'';
|
|
|
|
|
2024-04-07 02:45:20 +03:00
|
|
|
clientRunTorBrowser = pkgs.writeScriptBin "tor-browser" ''
|
2024-04-07 02:35:53 +03:00
|
|
|
PULSE_SERVER=tcp:192.168.7.10:4713 \
|
|
|
|
XAUTHORITY="/home/browser/.Xauthority" \
|
|
|
|
DBUS_SESSION_BUS_ADDRESS="" \
|
|
|
|
DISPLAY=192.168.7.10:0.0 \
|
2024-04-07 02:45:20 +03:00
|
|
|
${pkgs.apulse}/bin/apulse ${torBrowser}/bin/tor-browser $@
|
2024-04-07 02:35:53 +03:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
|
|
environment.systemPackages = [ hostRunTorBrowser ];
|
|
|
|
|
|
|
|
hardware.pulseaudio = {
|
|
|
|
enable = true;
|
|
|
|
systemWide = true;
|
|
|
|
support32Bit = true;
|
|
|
|
tcp = {
|
|
|
|
enable = true;
|
|
|
|
anonymousClients.allowedIpRanges = [ "127.0.0.1" "192.168.7.0/24" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
firewall.allowedTCPPorts = [ 4713 6000 ];
|
|
|
|
nat = {
|
|
|
|
enable = true;
|
|
|
|
internalInterfaces = [ "ve-browser" ];
|
|
|
|
externalInterface = "wg0";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
containers.browser = {
|
|
|
|
autoStart = true;
|
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress = "192.168.7.10";
|
|
|
|
localAddress = "192.168.7.11";
|
|
|
|
|
|
|
|
config = { config, pkgs, ... }: {
|
|
|
|
system.stateVersion = "23.11";
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
settings.X11Forwarding = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.extraUsers.browser = {
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/home/browser";
|
|
|
|
openssh.authorizedKeys.keys = data.publicKeys.users.jan;
|
|
|
|
extraGroups = [ "audio" "video" ];
|
2024-04-07 02:45:20 +03:00
|
|
|
packages = [ clientRunTorBrowser ];
|
2024-04-07 02:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|