diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index 200669395728..f57502d4c83e 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -19,8 +19,8 @@ in { base = mkOption { default = "${config.boot.kernelPackages.kernel}/dtbs"; defaultText = "\${config.boot.kernelPackages.kernel}/dtbs"; - example = literalExample "pkgs.deviceTree.raspberryPiDtbs"; - type = types.nullOr types.path; + example = literalExample "pkgs.deviceTree_rpi"; + type = types.path; description = '' The package containing the base device-tree (.dtb) to boot. Contains device trees bundled with the Linux kernel by default. @@ -30,7 +30,7 @@ in { overlays = mkOption { default = []; example = literalExample - "[\"\${pkgs.deviceTree.raspberryPiOverlays}/w1-gpio.dtbo\"]"; + "[\"\${pkgs.deviceTree_rpi.overlays}/w1-gpio.dtbo\"]"; type = types.listOf types.path; description = '' A path containing device tree overlays (.dtbo) to be applied to all @@ -41,9 +41,9 @@ in { package = mkOption { default = null; type = types.nullOr types.path; + internal = true; description = '' - A path containing device tree overlays (.dtbo) to be applied to all - base device-trees. Overrides `base` and `overlays`. + A path containing the result of applying `overlays` to `base`. ''; }; }; diff --git a/pkgs/os-specific/linux/device-tree.nix b/pkgs/os-specific/linux/device-tree/default.nix similarity index 56% rename from pkgs/os-specific/linux/device-tree.nix rename to pkgs/os-specific/linux/device-tree/default.nix index 81dccac8b8c8..13d819a08a5b 100644 --- a/pkgs/os-specific/linux/device-tree.nix +++ b/pkgs/os-specific/linux/device-tree/default.nix @@ -1,4 +1,4 @@ -{ stdenvNoCC, dtc, findutils, raspberrypifw }: +{ stdenvNoCC, dtc, findutils }: with stdenvNoCC.lib; { applyOverlays = (base: overlays: stdenvNoCC.mkDerivation { @@ -14,15 +14,4 @@ with stdenvNoCC.lib; { 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"; } diff --git a/pkgs/os-specific/linux/device-tree/raspberrypi.nix b/pkgs/os-specific/linux/device-tree/raspberrypi.nix new file mode 100644 index 000000000000..aa6edefd74d9 --- /dev/null +++ b/pkgs/os-specific/linux/device-tree/raspberrypi.nix @@ -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"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 44cd12b4db6c..d5698ee3914b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -169,7 +169,9 @@ in 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;