mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-12-24 09:50:56 +01:00
remove all DT imports
This commit is contained in:
parent
3027e45b9c
commit
9ba390ca28
10 changed files with 14 additions and 217 deletions
|
|
@ -1,17 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.hardware.raspberry-pi.audio;
|
||||
in {
|
||||
options.hardware.raspberry-pi.audio = {
|
||||
enable = lib.mkEnableOption "configuration for audio";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware = {
|
||||
raspberry-pi.deviceTree.base-dtb-params = [ "audio=on" ];
|
||||
pulseaudio.configFile = lib.mkOverride 990
|
||||
(pkgs.runCommand "default.pa" { } ''
|
||||
sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out
|
||||
'');
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -2,14 +2,7 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../sd-image
|
||||
./device-tree.nix
|
||||
./audio.nix
|
||||
./i2c.nix
|
||||
./i2s.nix
|
||||
./modesetting.nix
|
||||
];
|
||||
imports = [ ../sd-image ];
|
||||
|
||||
nixpkgs = { overlays = [ overlay ]; };
|
||||
boot = {
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.hardware.raspberry-pi.deviceTree;
|
||||
in {
|
||||
options.hardware.raspberry-pi.deviceTree = {
|
||||
base-dtb = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "bcm2711-rpi-4-b.dtb";
|
||||
description = "base dtb to apply";
|
||||
};
|
||||
base-dtb-params = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.string;
|
||||
default = [ ];
|
||||
example = [ "i2c1=on" "audio=on" ];
|
||||
description = "parameters to pass to the base dtb";
|
||||
};
|
||||
dt-overlays = lib.mkOption {
|
||||
type = with lib.types;
|
||||
listOf (submodule {
|
||||
options = {
|
||||
overlay = lib.mkOption { type = oneOf [ str path ]; };
|
||||
args = lib.mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [ ];
|
||||
example = [{
|
||||
overlay = "vc4-fkms-v3d";
|
||||
args = [ "cma-512" ];
|
||||
}];
|
||||
description = "dtb overlays to apply";
|
||||
};
|
||||
postInstall = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "bash command to run after building dtb";
|
||||
};
|
||||
};
|
||||
config = {
|
||||
hardware = {
|
||||
deviceTree = {
|
||||
enable = true;
|
||||
filter = cfg.base-dtb;
|
||||
package = let
|
||||
dtbsWithSymbols = pkgs.stdenv.mkDerivation {
|
||||
name = "dtbs-with-symbols";
|
||||
inherit (config.boot.kernelPackages.kernel)
|
||||
src nativeBuildInputs depsBuildBuild;
|
||||
patches = map (patch: patch.patch)
|
||||
config.boot.kernelPackages.kernel.kernelPatches;
|
||||
buildPhase = ''
|
||||
patchShebangs scripts/*
|
||||
substituteInPlace scripts/Makefile.lib \
|
||||
--replace 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget))' 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) -@'
|
||||
make ${pkgs.stdenv.hostPlatform.linux-kernel.baseConfig} ARCH="${pkgs.stdenv.hostPlatform.linuxArch}"
|
||||
make dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}"
|
||||
'';
|
||||
installPhase = ''
|
||||
make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}"
|
||||
'';
|
||||
};
|
||||
compiled-overlays = map (x:
|
||||
let
|
||||
overlay-file = if builtins.isPath x.overlay then
|
||||
pkgs.runCommand "overlay.dtbo" {
|
||||
buildInputs = with pkgs; [ dtc ];
|
||||
} "dtc -I dts -O dtb -o $out ${x.overlay}"
|
||||
else
|
||||
"${config.boot.kernelPackages.kernel}/dtbs/overlays/${x.overlay}.dtbo";
|
||||
in x // { overlay = overlay-file; }) cfg.dt-overlays;
|
||||
in lib.mkForce (pkgs.runCommand "device-tree-overlays" {
|
||||
buildInputs = with pkgs; [ findutils libraspberrypi ];
|
||||
} ''
|
||||
cd ${dtbsWithSymbols}/dtbs
|
||||
for dtb in $(find . -type f -name "${config.hardware.deviceTree.filter}")
|
||||
do
|
||||
install -D $dtb $out/$dtb
|
||||
|
||||
${
|
||||
lib.concatMapStrings (param: ''
|
||||
dtmerge -d $out/$dtb{,-merged} - ${param}
|
||||
mv $out/$dtb{-merged,}
|
||||
'') cfg.base-dtb-params
|
||||
}
|
||||
|
||||
${
|
||||
lib.concatMapStrings (x: ''
|
||||
dtmerge -d $out/$dtb{,-merged} ${x.overlay} ${
|
||||
builtins.concatStringsSep " " x.args
|
||||
}
|
||||
mv $out/$dtb{-merged,}
|
||||
'') compiled-overlays
|
||||
}
|
||||
done
|
||||
${cfg.postInstall}
|
||||
'');
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
14
rpi/i2c.nix
14
rpi/i2c.nix
|
|
@ -1,14 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.hardware.raspberry-pi.i2c;
|
||||
in {
|
||||
options.hardware.raspberry-pi.i2c = {
|
||||
enable = lib.mkEnableOption "configuration for i2c";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware = {
|
||||
raspberry-pi.deviceTree.base-dtb-params = [ "i2c1=on" ];
|
||||
i2c.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
13
rpi/i2s.nix
13
rpi/i2s.nix
|
|
@ -1,13 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.hardware.raspberry-pi.i2s;
|
||||
in {
|
||||
options.hardware.raspberry-pi.i2s = {
|
||||
enable = lib.mkEnableOption "configuration for i2s";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware = {
|
||||
raspberry-pi.deviceTree.base-dtb-params = [ "i2s=on" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.hardware.raspberry-pi.fkms-3d;
|
||||
in {
|
||||
options.hardware.raspberry-pi.fkms-3d = {
|
||||
enable = lib.mkEnableOption "Enable modesetting through fkms-3d";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware = {
|
||||
raspberry-pi.deviceTree.dt-overlays = [
|
||||
{
|
||||
overlay = "cma";
|
||||
args = [ ];
|
||||
}
|
||||
{
|
||||
overlay = "vc4-fkms-v3d";
|
||||
args = [ ];
|
||||
}
|
||||
];
|
||||
};
|
||||
services.xserver.videoDrivers = lib.mkBefore [ "modesetting" "fbdev" ];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue