feat(io): add various I/O configuration
This commit is contained in:
parent
78473d3ba8
commit
916751169b
42
faucet/io/default.nix
Normal file
42
faucet/io/default.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.faucet.io;
|
||||
in {
|
||||
options.faucet.io = {
|
||||
betaflight = mkEnableOption "betaflight udev rules" // { default = true; };
|
||||
bluetooth = mkEnableOption "bluetooth daemons and state persistence" // { default = true; };
|
||||
audio = mkEnableOption "pulseaudio server configuration" // { default = true; };
|
||||
coredump = mkEnableOption "save coredumps handled by systemd";
|
||||
};
|
||||
|
||||
config = {
|
||||
services.udev.extraRules = "" + (if cfg.betaflight then ''
|
||||
# DFU (Internal bootloader for STM32 and AT32 MCUs)
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", MODE="0664", GROUP="dialout"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="dialout"
|
||||
'' else "");
|
||||
|
||||
networking.networkmanager.enable = mkDefault true;
|
||||
hardware.bluetooth.enable = mkDefault cfg.bluetooth;
|
||||
|
||||
hardware.pulseaudio = mkIf cfg.audio {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
#nixpkgs.config.pulseaudio = mkIf cfg.audio;
|
||||
|
||||
security.pam.loginLimits = mkIf (!cfg.coredump) (singleton { domain = "*"; item = "core"; type = "hard"; value = "0"; });
|
||||
systemd.coredump.extraConfig = mkIf (!cfg.coredump) "Storage=none";
|
||||
|
||||
environment.persistence."/nix/persist/fhs".directories = [
|
||||
"/var/log"
|
||||
"/var/lib/systemd/backlight"
|
||||
] ++
|
||||
optional config.networking.networkmanager.enable "/etc/NetworkManager/system-connections" ++
|
||||
optional cfg.bluetooth "/var/lib/bluetooth" ++
|
||||
optional cfg.coredump "/var/lib/systemd/coredump";
|
||||
environment.persistence."/nix/persist/fhs".hideMounts = true;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue