-
Notifications
You must be signed in to change notification settings - Fork 3
/
i2c.nix
38 lines (33 loc) · 896 Bytes
/
i2c.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ config, lib, pkgs, ... }:
let cfg = config.hardware.raspberry-pi."4".i2c-bcm2708;
in {
options.hardware = {
raspberry-pi."4".i2c-bcm2708 = {
enable = lib.mkEnableOption ''
Enable the Raspberry Pi 4 hardware i2c controller.
'';
};
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
{
name = "i2c0";
dtsText = ''
/dts-v1/;
/plugin/;
/{
compatible = "raspberrypi,4-model-b";
fragment@1 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};
};
'';
}
];
};
};
}