2023-07-15 22:45:35 +08:00
|
|
|
inputs:
|
|
|
|
{
|
2024-03-25 11:30:50 +08:00
|
|
|
imports = inputs.localLib.findModules ./.;
|
2024-04-25 17:55:57 +08:00
|
|
|
options.nixos.hardware =
|
|
|
|
let
|
|
|
|
inherit (inputs.lib) mkOption types;
|
|
|
|
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
bluetooth = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
|
|
|
|
joystick = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
|
|
|
|
printer = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
|
|
|
|
sound = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
|
|
|
|
};
|
2024-03-25 11:37:21 +08:00
|
|
|
config = let inherit (inputs.config.nixos) hardware; in inputs.lib.mkMerge
|
|
|
|
[
|
|
|
|
# bluetooth
|
|
|
|
(inputs.lib.mkIf (hardware.bluetooth != null) { hardware.bluetooth.enable = true; })
|
|
|
|
# joystick
|
|
|
|
(inputs.lib.mkIf (hardware.joystick != null) { hardware = { xone.enable = true; xpadneo.enable = true; }; })
|
|
|
|
# printer
|
|
|
|
(
|
|
|
|
inputs.lib.mkIf (hardware.printer != null)
|
|
|
|
{
|
|
|
|
services =
|
2023-09-01 21:05:26 +08:00
|
|
|
{
|
2024-03-25 17:09:29 +08:00
|
|
|
printing =
|
|
|
|
{
|
|
|
|
enable = true;
|
|
|
|
drivers = inputs.lib.mkIf (inputs.config.nixos.system.nixpkgs.arch == "x86_64") [ inputs.pkgs.cnijfilter2 ];
|
|
|
|
};
|
2024-05-22 10:44:41 +08:00
|
|
|
avahi = { enable = true; nssmdns4 = true; openFirewall = true; };
|
2024-03-25 11:37:21 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|
|
|
|
# sound
|
|
|
|
(
|
|
|
|
inputs.lib.mkIf (hardware.sound != null)
|
|
|
|
{
|
|
|
|
hardware.pulseaudio.enable = false;
|
|
|
|
services.pipewire = { enable = true; alsa = { enable = true; support32Bit = true; }; pulse.enable = true; };
|
|
|
|
security.rtkit.enable = true;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
2023-07-15 22:45:35 +08:00
|
|
|
}
|