mirror of
https://github.com/ItsDrike/nixdots
synced 2024-11-15 01:27:17 +00:00
Compare commits
No commits in common. "e84f91507a37a766e3c5bec15d19a049ffb8162c" and "130fdae4bffd5f726ed90c0b17213e4275792dbb" have entirely different histories.
e84f91507a
...
130fdae4bf
|
@ -29,9 +29,6 @@
|
||||||
hostname = "herugrim";
|
hostname = "herugrim";
|
||||||
username = "itsdrike";
|
username = "itsdrike";
|
||||||
|
|
||||||
sound.enable = true;
|
|
||||||
bluetooth.enable = true;
|
|
||||||
|
|
||||||
impermanence = {
|
impermanence = {
|
||||||
root = {
|
root = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -17,13 +17,5 @@ in
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Username for the primary admin account for this system";
|
description = "Username for the primary admin account for this system";
|
||||||
};
|
};
|
||||||
|
|
||||||
sound = {
|
|
||||||
enable = mkEnableOption "sound related programs and audio-dependent programs";
|
|
||||||
};
|
|
||||||
|
|
||||||
bluetooth = {
|
|
||||||
enable = mkEnableOption "bluetooth modules, drivers and configuration program(s)";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf;
|
|
||||||
|
|
||||||
sys = config.myOptions.system.bluetooth;
|
|
||||||
in {
|
|
||||||
config = mkIf sys.enable {
|
|
||||||
modules.system.boot.extraKernelParams = ["btusb"];
|
|
||||||
|
|
||||||
hardware.bluetooth = {
|
|
||||||
enable = true;
|
|
||||||
package = pkgs.bluez5-experimental;
|
|
||||||
#hsphfpd.enable = true;
|
|
||||||
powerOnBoot = true;
|
|
||||||
disabledPlugins = ["sap"];
|
|
||||||
settings = {
|
|
||||||
General = {
|
|
||||||
JustWorksRepairing = "always";
|
|
||||||
MultiProfile = "multiple";
|
|
||||||
Experimental = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# https://nixos.wiki/wiki/Bluetooth
|
|
||||||
services.blueman.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -7,11 +7,9 @@ _: {
|
||||||
./environment
|
./environment
|
||||||
./impermanence
|
./impermanence
|
||||||
./security
|
./security
|
||||||
./multimedia
|
|
||||||
./programs.nix
|
./programs.nix
|
||||||
./system.nix
|
./system.nix
|
||||||
./network.nix
|
./network.nix
|
||||||
./bluetooth.nix
|
|
||||||
./localisation.nix
|
./localisation.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
_: {
|
|
||||||
imports = [
|
|
||||||
./sound
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf mkDefault;
|
|
||||||
cfg = config.myOptions.system.sound;
|
|
||||||
in {
|
|
||||||
imports = [ ./pipewire.nix ];
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
sound = {
|
|
||||||
enable = mkDefault false; # this just enables ALSA, which we don't really care abouyt
|
|
||||||
mediaKeys.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
inherit (lib.lists) optionals;
|
|
||||||
inherit (lib.generators) toLua;
|
|
||||||
|
|
||||||
cfg = config.myOptions.system.sound;
|
|
||||||
cfgBluetooth = config.myOptions.system.bluetooth;
|
|
||||||
in {
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
# in case pipewire was force disabled for whatever reason, fall
|
|
||||||
# back to PulseAudio to ensure that we still have audio. I do not
|
|
||||||
# like PA, but bad audio is better than no audio. Though we should
|
|
||||||
# always use PipeWire where available
|
|
||||||
hardware.pulseaudio.enable = !config.services.pipewire.enable;
|
|
||||||
|
|
||||||
# able to change scheduling policies, e.g. to SCHED_RR
|
|
||||||
# sounds server use RealtimeKit (rtkti) to acquire
|
|
||||||
# realtime priority
|
|
||||||
security.rtkit.enable = config.services.pipewire.enable;
|
|
||||||
|
|
||||||
# enable pipewire and configure it for low latency
|
|
||||||
# the below configuration may not fit every use case
|
|
||||||
# and you are recommended to experiment with the values
|
|
||||||
# in order to find the perfect configuration
|
|
||||||
services = {
|
|
||||||
pipewire = let
|
|
||||||
quantum = 64;
|
|
||||||
rate = 48000;
|
|
||||||
qr = "${toString quantum}/${toString rate}";
|
|
||||||
in {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
# emulation layers
|
|
||||||
audio.enable = true;
|
|
||||||
pulse.enable = true; # PA server emulation
|
|
||||||
jack.enable = true; # JACK audio emulation
|
|
||||||
alsa.enable = true; # Alsa emulation
|
|
||||||
|
|
||||||
extraConfig.pipewire."99-lowlatency" = {
|
|
||||||
context = {
|
|
||||||
properties.default.clock.min-quantum = quantum;
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
name = "libpipewire-module-rtkit";
|
|
||||||
flags = ["ifexists" "nofail"];
|
|
||||||
args = {
|
|
||||||
nice.level = -15;
|
|
||||||
rt = {
|
|
||||||
prio = 88;
|
|
||||||
time.soft = 200000;
|
|
||||||
time.hard = 200000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "libpipewire-module-protocol-pulse";
|
|
||||||
args = {
|
|
||||||
server.address = ["unix:native"];
|
|
||||||
pulse.min = {
|
|
||||||
req = qr;
|
|
||||||
quantum = qr;
|
|
||||||
frag = qr;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
stream.properties = {
|
|
||||||
node.latency = qr;
|
|
||||||
resample.quality = 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
wireplumber = {
|
|
||||||
enable = true;
|
|
||||||
configPackages = let
|
|
||||||
# generate "matches" section of the rules
|
|
||||||
matches = toLua {
|
|
||||||
multiline = false; # looks better while inline
|
|
||||||
indent = false;
|
|
||||||
} [[["node.name" "matches" "alsa_output.*"]]]; # nested lists are to produce `{{{ }}}` in the output
|
|
||||||
|
|
||||||
# generate "apply_properties" section of the rules
|
|
||||||
apply_properties = toLua {} {
|
|
||||||
"audio.format" = "S32LE";
|
|
||||||
"audio.rate" = rate * 2;
|
|
||||||
"api.alsa.period-size" = 2;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
[
|
|
||||||
(pkgs.writeTextDir "share/lowlatency.lua.d/99-alsa-lowlatency.lua" ''
|
|
||||||
alsa_monitor.rules = {
|
|
||||||
{
|
|
||||||
matches = ${matches};
|
|
||||||
apply_properties = ${apply_properties};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'')
|
|
||||||
]
|
|
||||||
++ optionals cfgBluetooth.enable [
|
|
||||||
(pkgs.writeTextDir "share/bluetooth.lua.d/51-bluez-config.lua" ''
|
|
||||||
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 ]"
|
|
||||||
}
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.user.services = {
|
|
||||||
pipewire.wantedBy = ["default.target"];
|
|
||||||
pipewire-pulse.wantedBy = ["default.target"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue