diff options
author | rnhmjoj <rnhmjoj@inventati.org> | 2022-08-19 21:34:32 +0200 |
---|---|---|
committer | rnhmjoj <rnhmjoj@inventati.org> | 2022-08-20 13:34:14 +0200 |
commit | 916ca8f2b0c208def051f8ea9760c534a40309db (patch) | |
tree | d7cbae3f6c7ec0a2dd68b4c9fb5bf382abe043f9 /nixos/modules/hardware | |
parent | 802ea456991723a936e302b91d004345482b569a (diff) |
nixos/hardware/device-tree: make overlays more reliable
This make the process of applying overlays more reliable by: 1. Ignoring dtb files that are not really device trees. [^1] 2. Adding a `filter` option (per-overlay, there already is a global one) to limit the files to which the overlay applies. This is useful in cases where the `compatible` string is ambiguous and multiple unrelated files match. Previously the script would fail in both cases. [^1]: For example, there is dtbs/overlays/overlay_map.dtb in the Raspberry Pi 1 kernel.
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r-- | nixos/modules/hardware/device-tree.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index 55852776220d3..6204c0fddd037 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -14,6 +14,15 @@ let ''; }; + filter = mkOption { + type = types.nullOr types.str; + default = null; + example = "*rpi*.dtb"; + description = lib.mdDoc '' + Only apply to .dtb files matching glob expression. + ''; + }; + dtsFile = mkOption { type = types.nullOr types.path; description = lib.mdDoc '' @@ -165,6 +174,7 @@ in ''; type = types.listOf (types.coercedTo types.path (path: { name = baseNameOf path; + filter = null; dtboFile = path; }) overlayType); description = lib.mdDoc '' |