This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / installer-tor.nix
1.7 kB 69 lines
1{ 2 lib, 3 pkgs, 4 modulesPath, 5 ... 6}: 7 8{ 9 imports = [ 10 # Import the images.nix module to enable image building 11 (modulesPath + "/image/images.nix") 12 13 # Include your Tor SSH configuration 14 ./tor-ssh.nix 15 ]; 16 17 # Enable SSH in the installer 18 services.openssh = { 19 enable = true; 20 settings = { 21 PermitRootLogin = "yes"; 22 PasswordAuthentication = true; 23 }; 24 }; 25 26 # Set a default root password for the installer 27 users.users.root.initialPassword = "nixos"; 28 29 # Ensure Tor starts automatically 30 systemd.services.tor = { 31 wantedBy = [ "multi-user.target" ]; 32 after = [ "network-online.target" ]; 33 }; 34 35 # Add a script to display the Tor hostname 36 environment.systemPackages = with pkgs; [ 37 (writeScriptBin "show-tor-address" '' 38 #!${pkgs.bash}/bin/bash 39 echo "Waiting for Tor hidden service to be created..." 40 while [ ! -f /var/lib/tor/onion/ssh/hostname ]; do 41 sleep 1 42 done 43 echo "" 44 echo "===============================================" 45 echo "SSH is available via Tor at:" 46 echo "" 47 cat /var/lib/tor/onion/ssh/hostname 48 echo "" 49 echo "To connect from another machine:" 50 echo "torify ssh root@$(cat /var/lib/tor/onion/ssh/hostname)" 51 echo "===============================================" 52 echo "" 53 '') 54 ]; 55 56 # Add message to installer greeting 57 services.getty.helpLine = lib.mkAfter '' 58 59 >>> To see the Tor hidden service address for SSH, run: show-tor-address 60 >>> Default root password is: nixos 61 ''; 62 63 # Automatically show Tor address on login 64 programs.bash.loginShellInit = '' 65 if [ -f /var/lib/tor/onion/ssh/hostname ]; then 66 show-tor-address 67 fi 68 ''; 69}