Commit 08783a39 authored by DavHau's avatar DavHau
Browse files

nixos: add option `hardware.enableAllHardware`

This allows users to simply enable support for all hardware by enabling the option `hardware.enableAllHardware`, instead of having to import `modules/profiles/all-hardware.nix`.

This is better, as the enableAllHardware option will be discoverable via search.nixos.org, while the `all-hardware.nix` is hidden inside nixpkgs and hard to discover.

Backward compatibility is provided by replacing the old `profiles/all-hardware.nix` with a file that sets the `enableAllHardware` option to true.
parent 45628b14
Loading
Loading
Loading
Loading
+109 −102
Original line number Diff line number Diff line
@@ -3,12 +3,18 @@
# enabled in the initrd.  Its primary use is in the NixOS installation
# CDs.

{ pkgs, lib,... }:
{ config, lib, pkgs, ... }:
let
  platform = pkgs.stdenv.hostPlatform;
in
{

  options = {
    hardware.enableAllHardware = lib.mkEnableOption "Enable support for most hardware";
  };

  config = lib.mkIf config.hardware.enableAllHardware {

    # The initrd has to contain any module that might be necessary for
    # supporting the most important parts of HW like drives.
    boot.initrd.availableKernelModules =
@@ -110,4 +116,5 @@ in

    # Include lots of firmware.
    hardware.enableRedistributableFirmware = true;
  };
}
+2 −1
Original line number Diff line number Diff line
@@ -6,11 +6,12 @@
    [ ./iso-image.nix

      # Profiles of this basic installation CD.
      ../../profiles/all-hardware.nix
      ../../profiles/base.nix
      ../../profiles/installation-device.nix
    ];

  hardware.enableAllHardware = true;

  # Adds terminus_font for people with HiDPI displays
  console.packages = options.console.packages.default ++ [ pkgs.terminus_font ];

+2 −1
Original line number Diff line number Diff line
@@ -10,8 +10,9 @@ with lib;
    ./netboot.nix

    # Profiles of this basic netboot media
    ../../profiles/all-hardware.nix
    ../../profiles/base.nix
    ../../profiles/installation-device.nix
  ];

  hardware.enableAllHardware = true;
}
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ in
  imports = [
    (mkRemovedOptionModule [ "sdImage" "bootPartitionID" ] "The FAT partition for SD image now only holds the Raspberry Pi firmware files. Use firmwarePartitionID to configure that partition's ID.")
    (mkRemovedOptionModule [ "sdImage" "bootSize" ] "The boot files for SD image have been moved to the main ext4 partition. The FAT partition now only holds the Raspberry Pi firmware files. Changing its size may not be required.")
    ../../profiles/all-hardware.nix
  ];

  options.sdImage = {
@@ -162,6 +161,8 @@ in
  };

  config = {
    hardware.enableAllHardware = true;

    fileSystems = {
      "/boot/firmware" = {
        device = "/dev/disk/by-label/${config.sdImage.firmwarePartitionName}";
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
  ./config/zram.nix
  ./hardware/acpilight.nix
  ./hardware/all-firmware.nix
  ./hardware/all-hardware.nix
  ./hardware/apple-touchbar.nix
  ./hardware/bladeRF.nix
  ./hardware/brillo.nix
Loading