Refactor the whole configuration

Reviewed-on: #1
This commit is contained in:
caem 2025-02-01 14:05:15 +01:00
parent fb5d4d46f8
commit 6cb66d86d2
153 changed files with 2078 additions and 3094 deletions

View file

@ -0,0 +1,54 @@
{ ... }:
{
boot.kernelParams = [ "preempt=full" ];
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
# Reduce latency
# https://wiki.nixos.org/wiki/PipeWire#Low-latency_setup
extraConfig = let
rate = builtins.toString 48000;
# The default value in the wiki is 32 but might result in crackling audio.
# If you get audio crackling try increasing this value until it's gone.
quantum = builtins.toString 128;
in {
pipewire."92-low-latency" = {
"context.properties" = {
"default.clock.rate" = "${rate}";
"default.clock.quantum" = "${quantum}";
"default.clock.min-quantum" = "${quantum}";
"default.clock.max-quantum" = "${quantum}";
};
};
pipewire-pulse."92-low-latency" = {
"context.properties" = [
{
name = "libpipewire-module-protocol-pulse";
args = { };
}
];
"pulse.properties" = {
"pulse.min.req" = "${quantum}/${rate}";
"pulse.default.req" = "${quantum}/${rate}";
"pulse.max.req" = "${quantum}/${rate}";
"pulse.min.quantum" = "${quantum}/${rate}";
"pulse.max.quantum" = "${quantum}/${rate}";
};
"stream.properties" = {
"node.latency" = "${quantum}/${rate}";
"resample.quality" = 1;
};
};
};
};
}

View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
boot = {
kernelModules = [ "kvm-amd" ];
extraModprobeConfig = "options kvm_amd nested=1";
};
hardware.cpu.amd.updateMicrocode = true;
hardware.firmware = with pkgs; [ linux-firmware ];
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
hardware = {
graphics = {
enable = true;
enable32Bit = true;
};
};
}

View file

@ -0,0 +1,44 @@
{ config, ... }:
{
imports = [
../graphics.nix
];
hardware = {
nvidia = {
open = true;
modesetting.enable = true;
package = config.boot.kernelPackages.nvidiaPackages.beta;
nvidiaSettings = false;
};
};
boot.kernelParams = [
"nvidia_drm.fbdev=1"
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
];
services.xserver.videoDrivers = [ "nvidia" ];
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "nvidia";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
NVD_BACKEND = "direct";
NIXOS_OZONE_WL = 1;
};
nixpkgs.config.cudaSupport = true;
nix = {
settings = {
substituters = [
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}