mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 11:13:54 -05:00
Aly Raffauf
a281c7255b
Some checks are pending
flakehub / flakehub-publish (push) Waiting to run
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
|
||
---|---|---|
.. | ||
default.nix | ||
locale.nix | ||
network.nix | ||
nix.nix | ||
README.md | ||
samba.nix | ||
secrets.nix | ||
wifi.nix |
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 wifi.nix
using config.networking.networkmanager.ensureProfiles.profiles
, provided by nixpkgs. I also provide helper functions for common wifi security types.
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 (passwords, certificates, and identities) are supported, but must be declared and available as variables with agenix. They will be replaced upon activation with envsubst
.
In short,
- Manually configure the WiFi network on one device.
- Export configuration to nix with
nm2nix
. - Add secrets to
secrets/wifi.age
as variables (e.g.MYPSK=1234567890
) - Edit the code generated by
nm2nix
to reference$MYPSK
instead of directly declaring the WPA password. - Commit and push changes.
- Rebuild hosts as required to propogate your new WiFi configuration.