From 94f863d84acb5340c3c999f1fa06678f7a5df9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 14 Apr 2022 18:18:30 +0200 Subject: nixos: add turris-wifi modules --- nixos/default.nix | 1 + nixos/modules/turris-defaults.nix | 6 +++--- nixos/modules/turris-wifi.nix | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 nixos/modules/turris-wifi.nix (limited to 'nixos') diff --git a/nixos/default.nix b/nixos/default.nix index e7c8f00..05d804d 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,4 +1,5 @@ { turris-board = import ./modules/turris-board.nix; turris-defaults = import ./modules/turris-defaults.nix; + turris-wifi = import ./modules/turris-wifi.nix; } diff --git a/nixos/modules/turris-defaults.nix b/nixos/modules/turris-defaults.nix index 8799664..2f61827 100644 --- a/nixos/modules/turris-defaults.nix +++ b/nixos/modules/turris-defaults.nix @@ -30,8 +30,8 @@ in { config = mkIf cnf.enable { # We do not need Grub as U-Boot supports boot using extlinux like file - boot.loader.grub.enable = false; - boot.loader.generic-extlinux-compatible.enable = true; + boot.loader.grub.enable = mkDefault false; + boot.loader.generic-extlinux-compatible.enable = mkDefault true; # Use early print to the serial console boot.kernelParams = [ "boot.shell_on_fail" @@ -43,7 +43,7 @@ in { ]; # Use the latest kernel - boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = mkDefault pkgs.linuxPackages_latest; # The supported deployment is on BTRFS boot.supportedFilesystems = [ "btrfs" ]; diff --git a/nixos/modules/turris-wifi.nix b/nixos/modules/turris-wifi.nix new file mode 100644 index 0000000..bd74523 --- /dev/null +++ b/nixos/modules/turris-wifi.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cnf = config.turris.wifi; + +in { + + options = { + turris.wifi = { + enable = mkOption { + type = types.bool; + default = true; + description = "Enable Turris WiFi configuration"; + }; + }; + }; + + config = mkIf cnf.enable { + # Needed for Ath10k firmware + hardware.firmware = with pkgs; [ firmwareLinuxNonfree ]; + + # The additional administration packages + environment.systemPackages = with pkgs; [ + iw + ] ++ optionals (config.turris.board == "mox") [ + ] ++ optionals (config.turris.board == "omnia") [ + ]; + + }; +} -- cgit v1.2.3