Working on modularizing stuff, again

This commit is contained in:
Chris Kruining 2024-07-21 14:03:57 +02:00
parent b698ce3485
commit 9ba5f8fdf0
32 changed files with 1481 additions and 88 deletions

View file

@ -1,19 +1,66 @@
{ pkgs, ... }:
{ config, options, lib, pkgs, ... }:
let
inherit (lib.attrsets) attrValues;
inherit (lib.modules) mkIf;
cfg = config.modules.hardware.pipewire;
in
{
sound.enable = false;
hardware.pulseaudio.enable = false;
options.modules.hardware.pipewire = let
inherit (lib.options) mkEnableOption;
in
{
enable = mkEnableOption "modern audio support";
};
users.extraGroups.audio.members = [ "chris" ];
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
config = mkIf cfg.enable {
user.packages = attrValues {
inherit (pkgs) easyeffects
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
wireplumber.enable = true;
pulse.enable = true;
# jack.enable = true;
alsa = {
enable = true;
support32Bit = true;
};
};
home.configFile = mkIf config.module.hardware.bluetooth.enable {
wireplumber-bluetooth = {
target = "wireplumber/bluetooth.lua.d/51-bluez-config.lua";
text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
wireplumber-disable-suspension = {
target = "wireplumber/main.lua.d/51-disable-suspension.lua";
text = ''
table.insert(alsa_monitor.rules, {
matches = {
{ -- Matches all sources.
{ "node.name", "matches", "alsa_input.*" },
},
{ -- Matches all sinks.
{ "node.name", "matches", "alsa_output.*" },
},
},
apply_properties = { ["session.suspend-timeout-seconds"] = 0 },
})
'';
};
};
pulse.enable = true;
jack.enable = true;
};
}

View file

@ -0,0 +1,39 @@
{ config, pkgs, ... }:
{
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
nvidia = {
modesetting.enable = true;
open = false;
nvidiaSettings = true;
powerManagement = {
enable = true;
finegrained = false;
};
package = let
rcu_patch = pkgs.fetchpatch {
url = "https://github.com/gentoo/gentoo/raw/c64caf53/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.223.02-gpl-pfn_valid.patch";
hash = "sha256-eZiQQp2S/asE7MfGvfe6dA/kdCvek9SYa/FFGp24dVg=";
};
in config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "535.154.05";
sha256_64bit = "sha256-fpUGXKprgt6SYRDxSCemGXLrEsIA6GOinp+0eGbqqJg=";
sha256_aarch64 = "sha256-G0/GiObf/BZMkzzET8HQjdIcvCSqB1uhsinro2HLK9k=";
openSha256 = "sha256-wvRdHguGLxS0mR06P5Qi++pDJBCF8pJ8hr4T8O6TJIo=";
settingsSha256 = "sha256-9wqoDEWY4I7weWW05F4igj1Gj9wjHsREFMztfEmqm10=";
persistencedSha256 = "sha256-d0Q3Lk80JqkS1B54Mahu2yY/WocOqFFbZVBh+ToGhaE=";
patches = [ rcu_patch ];
};
};
};
}