From d959aa19a1f99e53ad3bf18f83319c5190a95fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Wed, 27 Mar 2024 19:34:34 +0000 Subject: [PATCH] tweak sound latency settings --- nixos/boxes/yoga/default.nix | 34 +++------------ nixos/common-hardware.nix | 81 +++++++++++++++++------------------- nixos/gui/default.nix | 2 +- 3 files changed, 44 insertions(+), 73 deletions(-) diff --git a/nixos/boxes/yoga/default.nix b/nixos/boxes/yoga/default.nix index c41e2280..520e4445 100644 --- a/nixos/boxes/yoga/default.nix +++ b/nixos/boxes/yoga/default.nix @@ -1,12 +1,4 @@ -{ - config, - pkgs, - inputs, - lib, - system, - nixpkgs-nixos-unstable-and-unfree, - ... -}: { +{ config, pkgs, inputs, lib, system, nixpkgs-nixos-unstable-and-unfree, ... }: { networking.hostName = "yoga"; imports = [ @@ -22,9 +14,9 @@ hardware.trackpoint.enable = true; services.hardware.bolt.enable = true; - services.fprintd = {enable = true;}; + services.fprintd = { enable = true; }; - home-manager.users.cyryl = {lib, ...}: {home.packages = with pkgs; [];}; + home-manager.users.cyryl = { lib, ... }: { home.packages = with pkgs; [ ]; }; networking.networkmanager.enable = true; @@ -51,30 +43,14 @@ services.printing.enable = true; - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; users.users.cyryl = { isNormalUser = true; description = "cyryl"; - extraGroups = ["networkmanager" "wheel"]; - packages = with pkgs; []; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ ]; }; services.fwupd.enable = true; diff --git a/nixos/common-hardware.nix b/nixos/common-hardware.nix index cf932877..4c8ff096 100644 --- a/nixos/common-hardware.nix +++ b/nixos/common-hardware.nix @@ -1,41 +1,33 @@ -{ - config, - pkgs, - nixpkgs-nixos-unstable-and-unfree, - lib, - ... -}: { - boot.kernelModules = ["fuse"]; +{ config, pkgs, nixpkgs-nixos-unstable-and-unfree, lib, ... }: { + boot.kernelModules = [ "fuse" ]; services.smartd.enable = true; sound.enable = true; networking.networkmanager = { enable = true; - dispatcherScripts = [ - { - source = pkgs.writeText "upHook" '' - enable_disable_wifi () - { - result=$(nmcli dev | grep "ethernet" | grep -w "connected") - if [ -n "$result" ]; then - nmcli radio wifi off - else - nmcli radio wifi on - fi - } - - if [ "$2" = "up" ]; then - enable_disable_wifi + dispatcherScripts = [{ + source = pkgs.writeText "upHook" '' + enable_disable_wifi () + { + result=$(nmcli dev | grep "ethernet" | grep -w "connected") + if [ -n "$result" ]; then + nmcli radio wifi off + else + nmcli radio wifi on fi + } - if [ "$2" = "down" ]; then - enable_disable_wifi - fi - ''; - type = "basic"; - } - ]; + if [ "$2" = "up" ]; then + enable_disable_wifi + fi + + if [ "$2" = "down" ]; then + enable_disable_wifi + fi + ''; + type = "basic"; + }]; }; hardware.enableRedistributableFirmware = true; @@ -44,11 +36,9 @@ hardware.bluetooth = { enable = true; package = pkgs.bluez; - settings = {General = {Enable = "Source,Sink,Media,Socket";};}; + settings = { General = { Enable = "Source,Sink,Media,Socket"; }; }; }; - services.blueman.enable = true; - hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -56,14 +46,17 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; + extraConfig.pipewire."92-low-latency" = { + context.properties = { + default.clock.rate = 48000; + default.clock.quantum = 32; + default.clock.min-quantum = 32; + default.clock.max-quantum = 32; + }; + }; }; - environment.systemPackages = with pkgs; [ghostscript poppler]; + + environment.systemPackages = with pkgs; [ ghostscript poppler ]; services.printing = { enable = true; drivers = with pkgs; [ @@ -81,7 +74,8 @@ description = "Epson XP-540 via bolty"; name = "epson_xp540_via_bolty"; deviceUri = "ipp://bolty:631/printers/epson_xp540"; - model = "epson-inkjet-printer-escpr/Epson-XP-540_Series-epson-escpr-en.ppd"; + model = + "epson-inkjet-printer-escpr/Epson-XP-540_Series-epson-escpr-en.ppd"; ppdOptions = { PageSize = "A4"; Duplex = "DuplexNoTumble"; @@ -90,7 +84,8 @@ { description = "Samsung SCX-4623 Series"; name = "samsung-SCX-4623"; - deviceUri = "usb://Samsung/SCX-4623%20Series?serial=Z2TYBFFZC01007W&interface=1"; + deviceUri = + "usb://Samsung/SCX-4623%20Series?serial=Z2TYBFFZC01007W&interface=1"; model = "samsung/SCX-4623FW.ppd"; ppdOptions = { PageSize = "A4"; @@ -99,7 +94,7 @@ } ]; - services.udev.packages = []; + services.udev.packages = [ ]; hardware.sane = { enable = true; snapshot = true; diff --git a/nixos/gui/default.nix b/nixos/gui/default.nix index bef6aab9..c016b38c 100644 --- a/nixos/gui/default.nix +++ b/nixos/gui/default.nix @@ -72,7 +72,7 @@ yubikey-manager-qt yubikey-personalization yubikey-personalization-gui - ]) ++ (with nixpkgs-nixos-unstable; [ gnucash thunderbird ]) + ]) ++ (with nixpkgs-nixos-unstable; [ thunderbird ]) ++ [ nixpkgs-nixos-stable-and-unfree.discord ] ++ (with nixpkgs-nixos-unstable-and-unfree; [ hopper