dotfiles/nixos/common-hardware.nix
Cyryl Płotnicki d959aa19a1
Some checks failed
use nix / build (push) Failing after 2s
tweak sound latency settings
2024-03-27 19:34:34 +00:00

115 lines
2.8 KiB
Nix

{ 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
fi
if [ "$2" = "down" ]; then
enable_disable_wifi
fi
'';
type = "basic";
}];
};
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
hardware.bluetooth = {
enable = true;
package = pkgs.bluez;
settings = { General = { Enable = "Source,Sink,Media,Socket"; }; };
};
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.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 ];
services.printing = {
enable = true;
drivers = with pkgs; [
epson-escpr
nixpkgs-nixos-unstable-and-unfree.samsung-unified-linux-driver
gutenprint
];
extraConf = ''
Option pdftops-renderer hybrid
'';
};
hardware.printers.ensurePrinters = [
{
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";
ppdOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
};
}
{
description = "Samsung SCX-4623 Series";
name = "samsung-SCX-4623";
deviceUri =
"usb://Samsung/SCX-4623%20Series?serial=Z2TYBFFZC01007W&interface=1";
model = "samsung/SCX-4623FW.ppd";
ppdOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
};
}
];
services.udev.packages = [ ];
hardware.sane = {
enable = true;
snapshot = true;
extraBackends = with pkgs; [
nixpkgs-nixos-unstable-and-unfree.samsung-unified-linux-driver
sane-airscan
gawk
];
};
powerManagement = {
enable = lib.mkForce true;
resumeCommands = ''
${pkgs.autorandr}/bin/autorandr -c
'';
powertop.enable = true;
};
}