More wireless networking to module

This commit is contained in:
Jordan Holt 2023-12-25 23:28:14 +00:00
parent 61bdd78444
commit 30e88a3859
Signed by: jordan
GPG Key ID: B8CFFF61F1CCF520
3 changed files with 43 additions and 15 deletions

View File

@ -29,21 +29,6 @@
sound.enable = true;
age.secrets."passwords/networks.age" = {
file = "${inputs.secrets}/passwords/networks.age";
};
networking = {
wireless = {
enable = true;
interfaces = [ "wlan0" ];
environmentFile = config.age.secrets."passwords/networks.age".path;
networks = {
"Apollo 600 Mbps".psk = "@PSK_APOLLO@";
};
};
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
@ -109,6 +94,12 @@
};
modules = {
networking = {
wireless = {
enable = true;
interfaces = [ "wlan0" ];
};
};
services = {
borgmatic = {
enable = true;

View File

@ -26,6 +26,7 @@
./editors/neovim
./editors/vscode.nix
./networking/tailscale.nix
./networking/wireless.nix
./security/gpg.nix
./security/pass.nix
./services/borgmatic

View File

@ -0,0 +1,36 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let cfg = config.modules.networking.wireless;
in {
options.modules.networking.wireless = {
enable = mkOption {
default = false;
example = true;
description = mdDoc "Automatically connect to known networks";
};
interfaces = mkOption {
default = [ ]; # All interfaces
example = [ "wlan0" ];
description = mdDoc "Interfaces for `wpa_supplicant` to bind to";
};
};
config = mkIf cfg.enable {
age.secrets."passwords/networks" = {
file = "${inputs.secrets}/passwords/networks.age";
};
networking = {
wireless = {
enable = true;
interfaces = cfg.interfaces;
environmentFile = config.age.secrets.passwords/networks.path;
networks = {
"Apollo 600 Mbps".psk = "@PSK_APOLLO@";
};
};
};
};
}