mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	apply review suggestions from @06kellyjac
Co-authored-by: j-k <dev@j-k.io>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							128dad1c8d
						
					
				
				
					commit
					245d8f9f97
				
			@@ -1,9 +1,11 @@
 | 
			
		||||
# modification of nixpkgs deviceTree.applyOverlays to resolve https://github.com/NixOS/nixpkgs/issues/125354
 | 
			
		||||
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/device-tree/default.nix
 | 
			
		||||
{ lib, pkgs, stdenvNoCC, dtc, libraspberrypi }:
 | 
			
		||||
 | 
			
		||||
with lib; {
 | 
			
		||||
  applyOverlays = (base: overlays': stdenvNoCC.mkDerivation {
 | 
			
		||||
    name = "device-tree-overlays";
 | 
			
		||||
    nativeBuildInputs = [ dtc ];
 | 
			
		||||
    nativeBuildInputs = [ dtc libraspberrypi ];
 | 
			
		||||
    buildCommand = let
 | 
			
		||||
      overlays = toList overlays';
 | 
			
		||||
    in ''
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,15 @@
 | 
			
		||||
{ config, lib, pkgs, modulesPath, ... }:
 | 
			
		||||
let
 | 
			
		||||
  callPackage = path: overrides:
 | 
			
		||||
    let f = import path;
 | 
			
		||||
    in f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // overrides);
 | 
			
		||||
  cfg = config.hardware.raspberry-pi."4".apply-overlays-dtmerge;
 | 
			
		||||
  dt_ao_overlay = (final: prev: {
 | 
			
		||||
    deviceTree.applyOverlays = (prev.callPackage ./apply-overlays-dtmerge.nix { }).applyOverlays;
 | 
			
		||||
    deviceTree.applyOverlays = (prev.callPackage ./apply-overlays-dtmerge.nix { })
 | 
			
		||||
  });
 | 
			
		||||
in {
 | 
			
		||||
  options.hardware = {
 | 
			
		||||
    raspberry-pi."4".apply-overlays-dtmerge = {
 | 
			
		||||
      enable = lib.mkEnableOption ''
 | 
			
		||||
        replace deviceTree.applyOverlays implementation to use dtmerge from libraspberrypi.
 | 
			
		||||
        this can resolve issues with applying dtbs for the pi.
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user