nixos/hardware.deviceTree: Move things around

In response to comments, create a sub-folder for deviceTree packages
(starting with rpi), and a top-level package for helpers.
This commit is contained in:
Kai Wohlfahrt 2019-05-08 23:25:22 +01:00 committed by Kai Wohlfahrt
parent dd0a951279
commit 28cf80acf8
4 changed files with 23 additions and 18 deletions

View File

@ -19,8 +19,8 @@ in {
base = mkOption { base = mkOption {
default = "${config.boot.kernelPackages.kernel}/dtbs"; default = "${config.boot.kernelPackages.kernel}/dtbs";
defaultText = "\${config.boot.kernelPackages.kernel}/dtbs"; defaultText = "\${config.boot.kernelPackages.kernel}/dtbs";
example = literalExample "pkgs.deviceTree.raspberryPiDtbs"; example = literalExample "pkgs.deviceTree_rpi";
type = types.nullOr types.path; type = types.path;
description = '' description = ''
The package containing the base device-tree (.dtb) to boot. Contains The package containing the base device-tree (.dtb) to boot. Contains
device trees bundled with the Linux kernel by default. device trees bundled with the Linux kernel by default.
@ -30,7 +30,7 @@ in {
overlays = mkOption { overlays = mkOption {
default = []; default = [];
example = literalExample example = literalExample
"[\"\${pkgs.deviceTree.raspberryPiOverlays}/w1-gpio.dtbo\"]"; "[\"\${pkgs.deviceTree_rpi.overlays}/w1-gpio.dtbo\"]";
type = types.listOf types.path; type = types.listOf types.path;
description = '' description = ''
A path containing device tree overlays (.dtbo) to be applied to all A path containing device tree overlays (.dtbo) to be applied to all
@ -41,9 +41,9 @@ in {
package = mkOption { package = mkOption {
default = null; default = null;
type = types.nullOr types.path; type = types.nullOr types.path;
internal = true;
description = '' description = ''
A path containing device tree overlays (.dtbo) to be applied to all A path containing the result of applying `overlays` to `base`.
base device-trees. Overrides `base` and `overlays`.
''; '';
}; };
}; };

View File

@ -1,4 +1,4 @@
{ stdenvNoCC, dtc, findutils, raspberrypifw }: { stdenvNoCC, dtc, findutils }:
with stdenvNoCC.lib; { with stdenvNoCC.lib; {
applyOverlays = (base: overlays: stdenvNoCC.mkDerivation { applyOverlays = (base: overlays: stdenvNoCC.mkDerivation {
@ -14,15 +14,4 @@ with stdenvNoCC.lib; {
done done
''; '';
}); });
raspberryPiDtbs = stdenvNoCC.mkDerivation {
name = "raspberrypi-dtbs-${raspberrypifw.version}";
nativeBuildInputs = [ raspberrypifw ];
buildCommand = ''
mkdir -p $out/broadcom/
cp ${raspberrypifw}/share/raspberrypi/boot/bcm*.dtb $out/broadcom
'';
};
raspberryPiOverlays = "${raspberrypifw}/share/raspberrypi/boot/overlays";
} }

View File

@ -0,0 +1,14 @@
{ stdenvNoCC, raspberrypifw }:
stdenvNoCC.mkDerivation {
name = "raspberrypi-dtbs-${raspberrypifw.version}";
nativeBuildInputs = [ raspberrypifw ];
buildCommand = ''
mkdir -p $out/broadcom/
cp ${raspberrypifw}/share/raspberrypi/boot/bcm*.dtb $out/broadcom
'';
passthru = {
# Compatible overlays that may be used
overlays = "${raspberrypifw}/share/raspberrypi/boot/overlays";
};
}

View File

@ -169,7 +169,9 @@ in
demoit = callPackage ../servers/demoit { }; demoit = callPackage ../servers/demoit { };
deviceTree = callPackage ../os-specific/linux/device-tree.nix {}; deviceTree = callPackage ../os-specific/linux/device-tree {};
device-tree_rpi = callPackage ../os-specific/linux/device-tree/raspberrypi.nix {};
diffPlugins = (callPackage ../build-support/plugins.nix {}).diffPlugins; diffPlugins = (callPackage ../build-support/plugins.nix {}).diffPlugins;