refactor: replace WiFi service with declarative NetworkManager

- Remove unnecessary systemd.services.workshop-wifi-setup service
- Remove environment.etc."NetworkManager/workshop-wifi.env" file
- Add declarative networking.networkmanager.ensureProfiles configuration
- Remove redundant WiFi packages (wpa_supplicant, wirelesstools, iw)
- Update documentation to reflect automatic WiFi connection
- Clean up bash script references to old services

This simplifies the configuration and makes WiFi connection automatic on boot.
This commit is contained in:
2025-09-17 08:57:19 +02:00
parent 4cf1a3a715
commit 4dacf94c67
5 changed files with 89 additions and 124 deletions

View File

@@ -44,6 +44,7 @@ browser wordpress # Open directly in Firefox
## 💾 USB Environment ## 💾 USB Environment
Pre-configured with: Pre-configured with:
- **Automatic WiFi connection** to workshop network
- Docker Swarm + abra installation - Docker Swarm + abra installation
- SSH client for cloud access - SSH client for cloud access
- Wildcard DNS resolution (dnsmasq) - Wildcard DNS resolution (dnsmasq)
@@ -148,9 +149,9 @@ browser <TAB> # Shows deployed applications
## 🔧 Prerequisites ## 🔧 Prerequisites
- Nix with flakes enabled - Nix with flakes enabled
- SSH key at `~/.ssh/id_ed25519.pub`
- 2GB+ RAM for VM testing - 2GB+ RAM for VM testing
- USB drive (8GB+) for workshop distribution - USB drive (8GB+) for workshop distribution
- SSH key at `~/.ssh/id_ed25519.pub` (for cloud deployment only)
## 🛠️ Development Tools ## 🛠️ Development Tools
@@ -171,6 +172,9 @@ make clean # Clean build artifacts (./build/ and ./result/)
## 🔍 Troubleshooting ## 🔍 Troubleshooting
```bash ```bash
# Check WiFi connection (should connect automatically)
nmcli connection show --active
# Check DNS resolution # Check DNS resolution
dig @127.0.0.1 test.workshop.local dig @127.0.0.1 test.workshop.local

View File

@@ -2,7 +2,6 @@
pkgs, pkgs,
lib ? pkgs.lib, lib ? pkgs.lib,
isLiveIso ? false, isLiveIso ? false,
...
}: }:
let let
@@ -245,6 +244,31 @@ isoConfig
enable = true; enable = true;
wifi.backend = "wpa_supplicant"; # Standard backend for live ISOs wifi.backend = "wpa_supplicant"; # Standard backend for live ISOs
dns = "none"; # We use dnsmasq dns = "none"; # We use dnsmasq
ensureProfiles = {
profiles = {
"CODE_CRISPIES" = {
connection = {
id = "CODE_CRISPIES";
type = "wifi";
autoconnect = true;
};
wifi = {
mode = "infrastructure";
ssid = "CODE_CRISPIES";
};
wifi-security = {
key-mgmt = "wpa-psk";
psk = "scienceinthecity2025";
};
ipv4 = {
method = "auto";
};
ipv6 = {
method = "auto";
};
};
};
};
}; };
hostName = if isLiveIso then "workshop-live" else "workshop-vm"; hostName = if isLiveIso then "workshop-live" else "workshop-vm";
hosts."127.0.0.1" = [ hosts."127.0.0.1" = [
@@ -255,53 +279,6 @@ isoConfig
firewall.enable = false; # Workshop environment firewall.enable = false; # Workshop environment
}; };
# WiFi credentials file
environment.etc."NetworkManager/workshop-wifi.env" = {
text = ''
WORKSHOP_SSID="CODE_CRISPIES"
WORKSHOP_PSK="scienceinthecity2025"
'';
mode = "0600";
};
# WiFi connection setup service
systemd.services.workshop-wifi-setup = {
description = "Set up workshop WiFi connection";
wantedBy = [ "multi-user.target" ];
after = [ "NetworkManager.service" ];
wants = [ "NetworkManager.service" ];
path = with pkgs; [
networkmanager
coreutils
gnugrep
];
script = ''
# Source credentials
source /etc/NetworkManager/workshop-wifi.env
# Check if connection already exists
if nmcli connection show | grep -q "CODE_CRISPIES"; then
echo " Workshop WiFi connection already exists"
exit 0
fi
echo "📡 Setting up workshop WiFi connection..."
# Create WiFi connection
if nmcli device wifi connect "$WORKSHOP_SSID" password "$WORKSHOP_PSK" hidden no; then
echo " Workshop WiFi connection created and connected"
else
echo " Could not connect to workshop WiFi (network may not be available)"
echo " SSID: $WORKSHOP_SSID"
echo " Manual connection: nmcli device wifi connect '$WORKSHOP_SSID' password '$WORKSHOP_PSK'"
fi
'';
serviceConfig = {
Type = "oneshot";
User = "root";
RemainAfterExit = true;
};
};
# DNS Configuration - Wildcard *.workshop.local -> 127.0.0.1 # DNS Configuration - Wildcard *.workshop.local -> 127.0.0.1
services.dnsmasq = { services.dnsmasq = {
enable = true; enable = true;
@@ -407,9 +384,6 @@ isoConfig
networkmanager networkmanager
networkmanagerapplet # Network Manager GUI for GNOME networkmanagerapplet # Network Manager GUI for GNOME
gnome-control-center # GNOME Settings (includes network panel) gnome-control-center # GNOME Settings (includes network panel)
wpa_supplicant # Standard WiFi supplicant
wirelesstools # Standard WiFi tools
iw # Modern WiFi tools
docker docker
docker-compose docker-compose
gnome-terminal gnome-terminal
@@ -616,7 +590,7 @@ isoConfig
source <(sudo abra autocomplete bash) 2>/dev/null || true source <(sudo abra autocomplete bash) 2>/dev/null || true
echo " abra autocomplete enabled" echo " abra autocomplete enabled"
else else
echo " abra not found! Check: systemctl status workshop-abra-install" echo " abra not found! Install with: curl -fsSL https://install.abra.coopcloud.tech | bash"
fi fi
# Build info # Build info
@@ -686,7 +660,7 @@ isoConfig
echo " abra available via sudo: $(sudo which abra)" echo " abra available via sudo: $(sudo which abra)"
else else
echo " abra not available via sudo" echo " abra not available via sudo"
echo " Check: systemctl status workshop-abra-install" echo " Check: which abra && abra --version"
return 1 return 1
fi fi

View File

@@ -79,11 +79,15 @@ echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
## Workshop-Specific Network Setup ## Workshop-Specific Network Setup
### Connect to Workshop WiFi ### Workshop WiFi (Automatic)
The workshop environment automatically connects to the "CODE_CRISPIES" WiFi network using declarative NetworkManager configuration. No manual setup is required.
If you need to connect to a different network:
```bash ```bash
# Connect to workshop hotspot (if available) # Connect to workshop hotspot (if available)
nmcli device wifi connect "ziegel" password "1234567890" nmcli device wifi connect "CODE_CRISPIES" password "scienceinthecity2025"
``` ```
### Configure Local DNS Resolution ### Configure Local DNS Resolution
@@ -101,10 +105,10 @@ nslookup traefik.workshop.local 127.0.0.1
When internet is not available during workshop setup: When internet is not available during workshop setup:
1. **Configure Network Manually** 1. **Network Connects Automatically**
```bash ```bash
# Use one of the methods above to get network connectivity # WiFi connects automatically to "CODE_CRISPIES" on boot
nmcli device wifi connect "YourNetwork" password "YourPassword" # Check connection: nmcli connection show --active
``` ```
2. **Skip Online Dependencies** 2. **Skip Online Dependencies**

View File

@@ -71,6 +71,7 @@
## Getting Started Commands ## Getting Started Commands
```bash ```bash
# WiFi connects automatically - no manual setup needed!
# Set up your local environment # Set up your local environment
setup setup
@@ -116,5 +117,6 @@ Name: Android, Password: (ask facilitator)
→ Note: Terminal no longer auto-starts to prevent boot hangs → Note: Terminal no longer auto-starts to prevent boot hangs
**Can't connect to internet** **Can't connect to internet**
Try different WiFi network WiFi should connect automatically to "CODE_CRISPIES"
Use mobile hotspot as backup If not, use mobile hotspot as backup
→ Check: nmcli connection show --active

View File

@@ -19,32 +19,13 @@
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
# Server names for cloud connections
cloudServerNames = [
"hopper"
"curie"
"lovelace"
"noether"
"hamilton"
"franklin"
"johnson"
"clarke"
"goldberg"
"liskov"
"wing"
"rosen"
"shaw"
"karp"
"rich"
];
# Common configuration # Common configuration
commonConfig = commonConfig =
{ {
isLiveIso ? false, isLiveIso ? false,
}: }:
import ./common.nix { import ./common.nix {
inherit pkgs cloudServerNames isLiveIso; inherit pkgs isLiveIso;
}; };
in in
{ {