From a9b2d0e3f1136a4c05decbb3c2aa7a7cfb08256b Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 23 Feb 2021 12:40:08 +1300 Subject: [PATCH] Update to a clearer directory-structure --- microsoft/surface/default.nix | 2 +- microsoft/surface/firmware/default.nix | 8 -------- .../ath10k/K1535_Debian/board.bin | Bin .../{ => surface-go/ath10k}/ath10k.nix | 8 ++++---- .../firmware/surface-go/ath10k/default.nix | 18 ++++++++++++++++++ 5 files changed, 23 insertions(+), 13 deletions(-) delete mode 100644 microsoft/surface/firmware/default.nix rename microsoft/surface/firmware/{ => surface-go}/ath10k/K1535_Debian/board.bin (100%) rename microsoft/surface/firmware/{ => surface-go/ath10k}/ath10k.nix (75%) create mode 100644 microsoft/surface/firmware/surface-go/ath10k/default.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 7a49d08..05d78de 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -2,7 +2,7 @@ { imports = [ ./kernel - ./firmware ./hardware_configuration.nix + ./firmware/surface-go/ath10k ]; } diff --git a/microsoft/surface/firmware/default.nix b/microsoft/surface/firmware/default.nix deleted file mode 100644 index ea24877..0000000 --- a/microsoft/surface/firmware/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - hardware.enableAllFirmware = true; - hardware.firmware = [ - # TODO: Wrap with an option: - (pkgs.callPackage ./ath10k.nix {}) - ]; -} diff --git a/microsoft/surface/firmware/ath10k/K1535_Debian/board.bin b/microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin similarity index 100% rename from microsoft/surface/firmware/ath10k/K1535_Debian/board.bin rename to microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin diff --git a/microsoft/surface/firmware/ath10k.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix similarity index 75% rename from microsoft/surface/firmware/ath10k.nix rename to microsoft/surface/firmware/surface-go/ath10k/ath10k.nix index 1a98600..33ba320 100644 --- a/microsoft/surface/firmware/ath10k.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix @@ -1,8 +1,8 @@ {stdenv, lib, pkgs, firmwareLinuxNonfree, ...}: let repos = (pkgs.callPackage ../repos.nix {}); - ath10k = ./ath10k; - # ath10k = repos.ath10k-firmware; + killernetworking_firmware = ./K1535_Debian; + # killernetworking_firmware = repos.ath10k-firmware; in firmwareLinuxNonfree.overrideAttrs (old: rec { pname = "microsoft-surface-go-firmware-linux-nonfree"; @@ -19,8 +19,8 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { rm -v $out/lib/firmware/ath10k/QCA6174/{hw2.1,hw3.0}/board-2.bin # Install the Surface Go Wifi firmware: - cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/ - cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/ + cp ${killernetworking_firmware}/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/ + cp ${killernetworking_firmware}/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/ ''; outputHash = "1nc56qii96dfvxnv3ad3lxz2rzyqcbldk0h9rbm3l2pgamkvj8dw"; diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/firmware/surface-go/ath10k/default.nix new file mode 100644 index 0000000..bc52187 --- /dev/null +++ b/microsoft/surface/firmware/surface-go/ath10k/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k; +in +{ + options = { + hardware.microsoft-surface.firmware.surface-go-ath10k = { + enable = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; + }; + }; + + config = lib.mkIf cfg.enable { + hardware.enableAllFirmware = true; + hardware.firmware = [ + (pkgs.callPackage ./ath10k.nix {}) + ]; + }; +}