aux-config/modules/nixos/hardware/t2-mac-WirelessReload/default.nix
kB01 d61cd420a4
All checks were successful
/ Check Nix Flake (push) Successful in 2m5s
Added Host Ohybke
2025-02-14 01:30:40 +01:00

38 lines
922 B
Nix

{
inputs,
config,
lib,
pkgs,
system,
...
}:
let
cfg = config.hardware.t2-mac-WirelessReload;
in
{
options.hardware.t2-mac-WirelessReload.enable = lib.mkOption {
type = with lib.types; uniq bool;
default = false;
description = "Reloads the Wireless Drivers";
};
config = lib.mkIf (cfg.enable) {
# Service to load Driver with options
systemd.services."t2-mac-WirelessReload" = {
description = "Reloads Wireless Drivers for Mac";
path = [ pkgs.kmod ];
serviceConfig = {
Type = "oneshot";
ExecStart = ''
${pkgs.kmod.out}/bin/modprobe -r brcmfmac_wcc || true
${pkgs.kmod.out}/bin/modprobe -r brcmfmac || true
${pkgs.kmod.out}/bin/modprobe brcmfmac || true
${pkgs.kmod.out}/bin/modprobe -r hci_bcm4377 || true
${pkgs.kmod.out}/bin/modprobe hci_bcm4377 || true
'';
};
wantedBy = [ "multi-user.target" ];
};
};
}