feat(module): add common hardware/peripherals module

refactor(module): move audio configuration to module
This commit is contained in:
Jo 2024-09-07 08:46:55 +02:00
parent 77c95c1140
commit 078657f1e2
7 changed files with 52 additions and 68 deletions

View file

@ -0,0 +1,24 @@
{
lib,
inputs,
namespace,
config,
...
}: with lib; with lib.${namespace};
let
cfg = config.${namespace}.common.audio;
in {
options.${namespace}.common.audio = { enable = mkEnableOption "whether to enable common audio support and tweaks"; };
config = mkIf cfg.enable {
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
};
}

View file

@ -1,15 +1,7 @@
{
lib,
pkgs,
inputs,
namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal".
system, # The system architecture for this host (eg. `x86_64-linux`).
target, # The Snowfall Lib target for this system (eg. `x86_64-iso`).
format, # A normalized name for the system target (eg. `iso`).
virtual, # A boolean to determine whether this system is a virtual target using nixos-generators.
systems, # An attribute map of your defined hosts.
namespace,
config,
...
}: with lib; with lib.${namespace};
@ -19,6 +11,8 @@ in {
options.${namespace}.common.bluetooth = { enable = mkEnableOption "Enable bluetooth support on your current system"; };
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ bluez ];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;

View file

@ -0,0 +1,37 @@
{
lib,
pkgs,
namespace,
config,
options,
...
}: with lib; with lib.${namespace};
let
cfg = config.${namespace}.system.fonts;
in {
options.${namespace}.system.fonts = {
enable = mkEnableOption "Enable system font management";
fonts = mkOption {
type = types.package;
default = [ ];
example = [ noto-fonts noto-fonts-emoji ];
description = "Install additional font packages";
}
};
config = mkIf cfg.enable {
environment.variables = {
LOG_ICONS = "true"; # Enable icons in tooling (requires nerdfonts)
};
environment.systemPackages = with pkgs; [ font-manager ];
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
(nerdfonts.override { fonts = [ "Hack" ]; })
] ++ cfg.fonts;
};
}

View file

@ -0,0 +1,18 @@
{
lib,
inputs,
namespace,
config,
...
}: with lib; with lib.${namespace};
let
cfg = config.${namespace}.common.hardware;
in {
options.${namespace}.common.hardware = { enable = mkEnableOption "whether to enable common hardware support"; };
config = mkIf cfg.enable {
hardware.sensor.iio.enable = true; # Enable iio-sensor for automatic screen rotation and similar features.
hardware.flipperzero.enable = true; # Enable support for the flipperzero device.
};
}