add and use mkDisableOption
This commit is contained in:
parent
a742fe3a04
commit
89e6821370
|
@ -2,25 +2,25 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.hardware.raspberry-pi."4".leds;
|
cfg = config.hardware.raspberry-pi."4".leds;
|
||||||
|
mkDisableOption = name: lib.mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether to disable ${name}.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.hardware = {
|
options.hardware = {
|
||||||
raspberry-pi."4".leds = {
|
raspberry-pi."4".leds = {
|
||||||
disable-eth = lib.mkEnableOption ''
|
eth.disable = mkDisableOption ''ethernet LEDs.'';
|
||||||
disable ethernet LEDs.
|
act.disable = mkDisableOption ''activity LED.'';
|
||||||
'';
|
pwr.disable = mkDisableOption ''power LED.'';
|
||||||
disable-act = lib.mkEnableOption ''
|
|
||||||
disable activity LED.
|
|
||||||
'';
|
|
||||||
disable-pwr = lib.mkEnableOption ''
|
|
||||||
disable power LED.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Adapted from: https://gist.github.com/SFrijters/206d2c09656affb04284f076c75a1969
|
# Adapted from: https://gist.github.com/SFrijters/206d2c09656affb04284f076c75a1969
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf cfg.disable-eth {
|
(lib.mkIf cfg.eth.disable {
|
||||||
hardware.deviceTree = {
|
hardware.deviceTree = {
|
||||||
overlays = [
|
overlays = [
|
||||||
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README
|
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README
|
||||||
|
@ -58,7 +58,7 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(lib.mkIf cfg.disable-act {
|
(lib.mkIf cfg.act.disable {
|
||||||
hardware.deviceTree = {
|
hardware.deviceTree = {
|
||||||
overlays = [
|
overlays = [
|
||||||
# Debugging:
|
# Debugging:
|
||||||
|
@ -85,7 +85,7 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(lib.mkIf cfg.disable-pwr {
|
(lib.mkIf cfg.pwr.disable {
|
||||||
hardware.deviceTree = {
|
hardware.deviceTree = {
|
||||||
overlays = [
|
overlays = [
|
||||||
# Debugging:
|
# Debugging:
|
||||||
|
|
Loading…
Reference in a new issue