nixcfg/hosts/common
2024-07-20 20:36:31 -04:00
..
default.nix hosts: reorganize common config (#39) 2024-07-16 16:53:28 -04:00
locale.nix hosts: reorganize common config (#39) 2024-07-16 16:53:28 -04:00
network.nix Revert "hosts: enable tailscale ssh" 2024-07-19 22:25:47 -04:00
nix.nix hosts: reorganize common config (#39) 2024-07-16 16:53:28 -04:00
README.md hosts: added wifi docs 2024-07-20 20:36:31 -04:00
samba.nix code cleanup (#47) 2024-07-18 21:05:35 -04:00
secrets.nix hosts: reorganize common config (#39) 2024-07-16 16:53:28 -04:00
wifi.nix hosts: move wifi networks to wifi.nix 2024-07-19 22:25:16 -04:00

common

Overview

Common modules for my nix hosts that aren't better expressed as options & flake outputs.

Declarative WiFi Connections

WiFi networks can be configured declaratiely in nixosModules/system/wifi.nix using config.networking.networkmanager.ensureProfiles.profiles, provided by nixpkgs.

nm2nix can generate nix code for all WiFi networks currently configured in /etc/NetworkManager/system-connections/ and /run/NetworkManager/system-connections with the following command:

sudo su -c "cd /etc/NetworkManager/system-connections && nix --extra-experimental-features 'nix-command flakes' run github:Janik-Haag/nm2nix | nix --extra-experimental-features 'nix-command flakes' run nixpkgs#nixfmt-rfc-style"
\[Secrets

In short,

  1. Manually configure the WiFi network on one device.
  2. Export configuration to nix with nm2nix.
  3. Add secrets to secrets/wifi.age as variables (e.g. MYPSK=1234567890)
  4. Edit the code generated by nm2nix to reference $MYPSK instead of directly declaring the WPA password.
  5. Commit and push changes.
  6. Rebuild hosts as required to propogate your new WiFi configuration.