refactor: complete rewrite
This commit is contained in:
parent
19a4bbda3c
commit
8e81943cf9
399 changed files with 3396 additions and 8042 deletions
70
modules/nixos/hardware/features/audio.nix
Normal file
70
modules/nixos/hardware/features/audio.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) elem;
|
||||
inherit (lib) mkIf;
|
||||
inherit (config.ooknet.hardware) features;
|
||||
in {
|
||||
# generic audio configuration
|
||||
config = mkIf (elem "audio" features) {
|
||||
hardware.pulseaudio.enable = false;
|
||||
services = {
|
||||
pipewire = {
|
||||
enable = true;
|
||||
audio.enable = true;
|
||||
alsa = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
wireplumber.enable = true;
|
||||
};
|
||||
|
||||
# realtime audio
|
||||
udev.extraRules = ''
|
||||
KERNEL=="cpu_dma_latency", GROUP="audio"
|
||||
KERNEL=="rtc0", GROUP="audio"
|
||||
KERNEL=="hpet", GROUP="audio"
|
||||
'';
|
||||
};
|
||||
|
||||
security = {
|
||||
rtkit.enable = true;
|
||||
pam.loginLimits = [
|
||||
{
|
||||
domain = "@audio";
|
||||
item = "nofile";
|
||||
type = "soft";
|
||||
value = "99999";
|
||||
}
|
||||
{
|
||||
domain = "@audio";
|
||||
item = "nofile";
|
||||
type = "hard";
|
||||
value = "99999";
|
||||
}
|
||||
{
|
||||
domain = "@audio";
|
||||
item = "rtprio";
|
||||
type = "-";
|
||||
value = "99";
|
||||
}
|
||||
{
|
||||
domain = "@audio";
|
||||
item = "memlock";
|
||||
type = "-";
|
||||
value = "unlimited";
|
||||
}
|
||||
{
|
||||
domain = "@audio";
|
||||
type = "-";
|
||||
item = "nice";
|
||||
value = -11;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
13
modules/nixos/hardware/features/backlight.nix
Normal file
13
modules/nixos/hardware/features/backlight.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (config.ooknet.hardware) features;
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
in {
|
||||
config = mkIf (elem "backlight" features) {
|
||||
hardware.brillo.enable = true;
|
||||
};
|
||||
}
|
||||
44
modules/nixos/hardware/features/battery.nix
Normal file
44
modules/nixos/hardware/features/battery.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem attrValues;
|
||||
inherit (config.ooknet.hardware) features;
|
||||
in {
|
||||
config = mkIf (elem "battery" features) {
|
||||
services = {
|
||||
# cpu power usage optimizer
|
||||
auto-cpufreq = {enable = true;};
|
||||
|
||||
# application interface for power management
|
||||
upower = {
|
||||
enable = true;
|
||||
percentageLow = 25;
|
||||
percentageCritical = 5;
|
||||
percentageAction = 3;
|
||||
criticalPowerAction = "Hibernate";
|
||||
};
|
||||
|
||||
# daemon for monitoring and controlling temperature
|
||||
thermald = {enable = true;};
|
||||
|
||||
# put this here because if we are enabling the battery modules
|
||||
# we are most likely using a laptop
|
||||
# lidSwitch defines the action to perform when the laptop lid is
|
||||
# closed
|
||||
logind = {lidSwitch = "suspend";};
|
||||
};
|
||||
boot = {
|
||||
kernelModules = ["acpi_call"];
|
||||
extraModulePackages = attrValues {
|
||||
inherit (config.boot.kernelPackages) acpi_call cpupower;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = attrValues {
|
||||
inherit (pkgs) acpi powertop;
|
||||
};
|
||||
};
|
||||
}
|
||||
26
modules/nixos/hardware/features/bluetooth.nix
Normal file
26
modules/nixos/hardware/features/bluetooth.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem attrValues;
|
||||
inherit (config.ooknet.hardware) features;
|
||||
in {
|
||||
config = mkIf (elem "bluetooth" features) {
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
package = pkgs.bluez5-experimental;
|
||||
};
|
||||
|
||||
environment.systemPackages = attrValues {
|
||||
#inherit (self.packages.${pkgs.system}) live-buds-cli;
|
||||
inherit (pkgs) bluetuith;
|
||||
};
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/issues/114222
|
||||
systemd.user.services.telephony_client.enable = false;
|
||||
};
|
||||
}
|
||||
11
modules/nixos/hardware/features/default.nix
Normal file
11
modules/nixos/hardware/features/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
imports = [
|
||||
./video.nix
|
||||
./printing.nix
|
||||
./audio.nix
|
||||
./battery.nix
|
||||
./backlight.nix
|
||||
./ssd.nix
|
||||
# ./bluetooth.nix
|
||||
];
|
||||
}
|
||||
24
modules/nixos/hardware/features/printing.nix
Normal file
24
modules/nixos/hardware/features/printing.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
inherit (config.ooknet.hardware) features;
|
||||
in {
|
||||
config = mkIf (elem "printing" features) {
|
||||
services = {
|
||||
printing = {
|
||||
enable = true;
|
||||
drivers = [pkgs.hplip];
|
||||
};
|
||||
avahi = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
nssmdns4 = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
23
modules/nixos/hardware/features/ssd.nix
Normal file
23
modules/nixos/hardware/features/ssd.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
inherit (config.ooknet.hardware) features;
|
||||
in {
|
||||
config = mkIf (elem "ssd" features) {
|
||||
services.fstrim = {
|
||||
enable = true;
|
||||
};
|
||||
# only run fstrim while connected on AC
|
||||
systemd.services.fstrim = {
|
||||
unitConfig.ConditionACPower = true;
|
||||
serviceConfig = {
|
||||
Nice = 19;
|
||||
IOSchedulingClass = "idle";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
19
modules/nixos/hardware/features/video.nix
Normal file
19
modules/nixos/hardware/features/video.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
inherit (config.ooknet.hardware) features;
|
||||
in {
|
||||
config = mkIf (elem "video" features) {
|
||||
hardware = {
|
||||
graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue