mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
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.
This commit is contained in:
parent
45628b1432
commit
08783a39b0
6 changed files with 98 additions and 82 deletions
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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
|
||||
|
|
5
nixos/modules/profiles/all-hardware.nix
Normal file
5
nixos/modules/profiles/all-hardware.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Set `hardware.enableAllHardware = true` instead of importing this file.
|
||||
# This file provides backwards compatibility for older configurations.
|
||||
{
|
||||
hardware.enableAllHardware = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue