pipewire low latency; boot entry to pass gpu to vm; etc
This commit is contained in:
parent
b4ed70706f
commit
43e00a5481
|
@ -94,6 +94,13 @@
|
||||||
bat = {
|
bat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
bottom = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
flags.network_use_bytes = true;
|
||||||
|
flags.enable_gpu_memory = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
lsd = {
|
lsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -122,7 +129,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
rclone fuse jq appimage-run python3Full killall
|
rclone sshfs fuse
|
||||||
comma
|
jq python3Full killall
|
||||||
|
appimage-run comma
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@
|
||||||
# home.file.".Xdefaults".source = /. + "/${config.home.homeDirectory}/.Xresources";
|
# home.file.".Xdefaults".source = /. + "/${config.home.homeDirectory}/.Xresources";
|
||||||
home.file.".Xdefaults".source = config.home.file."${config.home.homeDirectory}/.Xresources".source;
|
home.file.".Xdefaults".source = config.home.file."${config.home.homeDirectory}/.Xresources".source;
|
||||||
services.gammastep.enable = true;
|
services.gammastep.enable = true;
|
||||||
services.kdeconnect.enable = true;
|
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
gtk = {
|
gtk = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -130,7 +129,7 @@
|
||||||
qt5ct qgnomeplatform
|
qt5ct qgnomeplatform
|
||||||
# various programs i use
|
# various programs i use
|
||||||
keepassxc nheko qbittorrent anki mumble
|
keepassxc nheko qbittorrent anki mumble
|
||||||
nextcloud-client gnome.zenity
|
nextcloud-client gnome.zenity kdeconnect
|
||||||
# cli tools
|
# cli tools
|
||||||
imagemagick ffmpeg
|
imagemagick ffmpeg
|
||||||
# fonts
|
# fonts
|
||||||
|
|
|
@ -383,10 +383,13 @@ in
|
||||||
export XDG_CURRENT_DESKTOP=sway
|
export XDG_CURRENT_DESKTOP=sway
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
services.swayidle = {
|
services.swayidle = let swaylock-start = builtins.toString (with pkgs; writeScript "swaylock-start" ''
|
||||||
|
#! ${bash}/bin/bash
|
||||||
|
${procps}/bin/pgrep -fx ${swaylock}/bin/swaylock || ${swaylock}/bin/swaylock
|
||||||
|
''); in {
|
||||||
enable = true;
|
enable = true;
|
||||||
events = [
|
events = [
|
||||||
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; }
|
{ event = "before-sleep"; command = swaylock-start; }
|
||||||
# after-resume, lock, unlock
|
# after-resume, lock, unlock
|
||||||
];
|
];
|
||||||
timeouts = [
|
timeouts = [
|
||||||
|
@ -394,7 +397,7 @@ in
|
||||||
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
|
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
|
||||||
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; }
|
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; }
|
||||||
{ timeout = 600;
|
{ timeout = 600;
|
||||||
command = "${pkgs.swaylock}/bin/swaylock"; }
|
command = swaylock-start; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
programs.swaylock.settings = let textColor = "#ebdadd"; bgColor = "#24101ac0"; in {
|
programs.swaylock.settings = let textColor = "#ebdadd"; bgColor = "#24101ac0"; in {
|
||||||
|
|
|
@ -17,6 +17,17 @@
|
||||||
};
|
};
|
||||||
xsession.windowManager.i3.enable = true;
|
xsession.windowManager.i3.enable = true;
|
||||||
wayland.windowManager.sway.enable = true;
|
wayland.windowManager.sway.enable = true;
|
||||||
|
terminals = ["kitty" "urxvt"];
|
||||||
|
services.mpd = {
|
||||||
|
enable = true;
|
||||||
|
network.startWhenNeeded = true;
|
||||||
|
};
|
||||||
|
services.mpdris2 = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
programs.ncmpcpp = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||||
"steam-run"
|
"steam-run"
|
||||||
"steam"
|
"steam"
|
||||||
|
@ -24,14 +35,14 @@
|
||||||
"steam-runtime"
|
"steam-runtime"
|
||||||
"steamcmd"
|
"steamcmd"
|
||||||
];
|
];
|
||||||
terminals = ["kitty" "urxvt"];
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
steam-run steam
|
steam-run steam
|
||||||
easyeffects
|
easyeffects
|
||||||
wineWowPackages.waylandFull
|
# wineWowPackages.waylandFull
|
||||||
winetricks
|
winetricks
|
||||||
protontricks proton-caller
|
protontricks # proton-caller
|
||||||
bottles
|
bottles
|
||||||
|
virtmanager
|
||||||
gimp krita blender
|
gimp krita blender
|
||||||
tdesktop
|
tdesktop
|
||||||
clang rustc rustfmt cargo clippy
|
clang rustc rustfmt cargo clippy
|
||||||
|
@ -53,24 +64,9 @@
|
||||||
xdg.configFile."looking-glass/client.ini".text = ''
|
xdg.configFile."looking-glass/client.ini".text = ''
|
||||||
[app]
|
[app]
|
||||||
shmFile=/dev/kvmfr0
|
shmFile=/dev/kvmfr0
|
||||||
capture=dxgi
|
|
||||||
|
|
||||||
[dxgi]
|
|
||||||
copyBackend=d3d12
|
|
||||||
d3d12CopySleep=5
|
|
||||||
disableDamage=false
|
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
rawMouse=yes
|
rawMouse=yes
|
||||||
escapeKey=KEY_INSERT
|
escapeKey=KEY_INSERT
|
||||||
|
|
||||||
[egl]
|
|
||||||
vsync=yes
|
|
||||||
|
|
||||||
[opengl]
|
|
||||||
vsync=yes
|
|
||||||
|
|
||||||
[win]
|
|
||||||
jitRender=yes
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
passGpuAtBoot = mkOption {
|
passGpuAtBoot = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether to pass the GPU at boot (can be more stable)";
|
description = "Whether to pass the GPU at boot (can be more stable). If false, a bootloader entry to do it will still be available.";
|
||||||
};
|
};
|
||||||
pciIDs = mkOption {
|
pciIDs = mkOption {
|
||||||
type = with types; listOf str;
|
type = with types; listOf str;
|
||||||
|
@ -70,7 +70,24 @@
|
||||||
gpuIDs = lib.concatStringsSep "," cfg.pciIDs;
|
gpuIDs = lib.concatStringsSep "," cfg.pciIDs;
|
||||||
enableIvshmem = config.vfio.lookingGlass.enable && (builtins.length config.vfio.lookingGlass.ivshmem) > 0;
|
enableIvshmem = config.vfio.lookingGlass.enable && (builtins.length config.vfio.lookingGlass.ivshmem) > 0;
|
||||||
in {
|
in {
|
||||||
|
specialisation.vfio.configuration = lib.mkIf (!cfg.passGpuAtBoot) {
|
||||||
|
boot.kernelParams = [ "early_load_vfio" ];
|
||||||
|
};
|
||||||
boot = {
|
boot = {
|
||||||
|
initrd.postDeviceCommands = lib.mkIf (!cfg.passGpuAtBoot) ''
|
||||||
|
for o in $(cat /proc/cmdline); do
|
||||||
|
case $o in
|
||||||
|
early_load_vfio)
|
||||||
|
loadVfio=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if [[ -n "$loadVfio" ]]; then
|
||||||
|
modprobe vfio
|
||||||
|
modprobe vfio_iommu_type1
|
||||||
|
modprobe vfio_pci
|
||||||
|
fi
|
||||||
|
'';
|
||||||
initrd.kernelModules = [
|
initrd.kernelModules = [
|
||||||
(if cfg.intelCpu then "kvm-intel" else "kvm-amd")
|
(if cfg.intelCpu then "kvm-intel" else "kvm-amd")
|
||||||
] ++ (if cfg.passGpuAtBoot then [
|
] ++ (if cfg.passGpuAtBoot then [
|
||||||
|
@ -79,6 +96,12 @@
|
||||||
"vfio_pci"
|
"vfio_pci"
|
||||||
"vfio_virqfd"
|
"vfio_virqfd"
|
||||||
] else []);
|
] else []);
|
||||||
|
initrd.availableKernelModules = lib.mkIf (!cfg.passGpuAtBoot) [
|
||||||
|
"vfio"
|
||||||
|
"vfio_iommu_type1"
|
||||||
|
"vfio_pci"
|
||||||
|
"vfio_virqfd"
|
||||||
|
];
|
||||||
extraModulePackages =
|
extraModulePackages =
|
||||||
with config.boot.kernelPackages;
|
with config.boot.kernelPackages;
|
||||||
lib.mkIf enableIvshmem [ kvmfr ];
|
lib.mkIf enableIvshmem [ kvmfr ];
|
||||||
|
@ -118,11 +141,10 @@
|
||||||
qemu = {
|
qemu = {
|
||||||
ovmf.enable = true;
|
ovmf.enable = true;
|
||||||
# Full is needed for TPM and secure boot emulation
|
# Full is needed for TPM and secure boot emulation
|
||||||
ovmf.packages = [ pkgs.OVMFFull ];
|
ovmf.packages = [ pkgs.OVMFFull.fd ];
|
||||||
# TPM emulation
|
# TPM emulation
|
||||||
swtpm.enable = true;
|
swtpm.enable = true;
|
||||||
verbatimConfig = ''
|
verbatimConfig = ''
|
||||||
nvram = [ "${pkgs.OVMFFull}/FV/OVMF.fd:${pkgs.OVMFFull}/FV/OVMF_VARS.fd" ]
|
|
||||||
cgroup_device_acl = [
|
cgroup_device_acl = [
|
||||||
"/dev/kvmfr0",
|
"/dev/kvmfr0",
|
||||||
"/dev/vfio/vfio", "/dev/vfio/11", "/dev/vfio/12",
|
"/dev/vfio/vfio", "/dev/vfio/11", "/dev/vfio/12",
|
||||||
|
|
|
@ -11,9 +11,13 @@
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
nix-gaming = {
|
||||||
|
url = "github:fufexan/nix-gaming";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, utils, nixos-hardware, rust-overlay, impermanence }:
|
outputs = inputs@{ self, nixpkgs, utils, nixos-hardware, rust-overlay, impermanence, nix-gaming }:
|
||||||
let
|
let
|
||||||
hw = nixos-hardware.nixosModules;
|
hw = nixos-hardware.nixosModules;
|
||||||
# IRL-related stuff I'd rather not put into git
|
# IRL-related stuff I'd rather not put into git
|
||||||
|
@ -38,6 +42,7 @@
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/nixmsi.nix
|
./hosts/nixmsi.nix
|
||||||
impermanence.nixosModule
|
impermanence.nixosModule
|
||||||
|
nix-gaming.nixosModules.pipewireLowLatency
|
||||||
hw.common-pc-ssd # enables fstrim
|
hw.common-pc-ssd # enables fstrim
|
||||||
hw.common-cpu-amd # microcode
|
hw.common-cpu-amd # microcode
|
||||||
hw.common-cpu-amd-pstate # amd-pstate
|
hw.common-cpu-amd-pstate # amd-pstate
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
efiPart = "/dev/disk/by-uuid/D77D-8CE0";
|
||||||
|
|
||||||
|
encPart = "/dev/disk/by-uuid/ce6ccdf0-7b6a-43ae-bfdf-10009a55041a";
|
||||||
cryptrootUuid = "f4edc0df-b50b-42f6-94ed-1c8f88d6cdbb";
|
cryptrootUuid = "f4edc0df-b50b-42f6-94ed-1c8f88d6cdbb";
|
||||||
cryptroot = "/dev/disk/by-uuid/${cryptrootUuid}";
|
cryptroot = "/dev/disk/by-uuid/${cryptrootUuid}";
|
||||||
encPart = "/dev/disk/by-uuid/ce6ccdf0-7b6a-43ae-bfdf-10009a55041a";
|
|
||||||
efiPart = "/dev/disk/by-uuid/D77D-8CE0";
|
dataPart = "/dev/disk/by-uuid/f1447692-fa7c-4bd6-9cb5-e44c13fddfe3";
|
||||||
|
datarootUuid = "fa754b1e-ac83-4851-bf16-88efcd40b657";
|
||||||
|
dataroot = "/dev/disk/by-uuid/${datarootUuid}";
|
||||||
in {
|
in {
|
||||||
system.stateVersion = "22.11";
|
system.stateVersion = "22.11";
|
||||||
|
|
||||||
|
@ -24,6 +29,13 @@ in {
|
||||||
bypassWorkqueues = true;
|
bypassWorkqueues = true;
|
||||||
keyFile = "/crypto_keyfile.bin";
|
keyFile = "/crypto_keyfile.bin";
|
||||||
};
|
};
|
||||||
|
luks.devices."dataroot" = {
|
||||||
|
device = dataPart;
|
||||||
|
preLVM = true;
|
||||||
|
allowDiscards = true;
|
||||||
|
bypassWorkqueues = true;
|
||||||
|
keyFile = "/crypto_keyfile.bin";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
resumeDevice = cryptroot;
|
resumeDevice = cryptroot;
|
||||||
kernelParams = [
|
kernelParams = [
|
||||||
|
@ -101,6 +113,9 @@ in {
|
||||||
options = [ discard compress "subvol=@boot" ]; };
|
options = [ discard compress "subvol=@boot" ]; };
|
||||||
"/boot/efi" =
|
"/boot/efi" =
|
||||||
{ device = efiPart; fsType = "vfat"; inherit neededForBoot; };
|
{ device = efiPart; fsType = "vfat"; inherit neededForBoot; };
|
||||||
|
"/data" =
|
||||||
|
{ device = dataroot; fsType = "btrfs";
|
||||||
|
options = [ discard compress ]; };
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.persistence."/persist" = {
|
environment.persistence."/persist" = {
|
||||||
|
@ -147,8 +162,9 @@ in {
|
||||||
i18n.supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ];
|
i18n.supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ];
|
||||||
networking.useDHCP = true;
|
networking.useDHCP = true;
|
||||||
# networking.firewall.enable = false;
|
# networking.firewall.enable = false;
|
||||||
networking.firewall.allowedTCPPorts = [ 27015 25565 7777 ];
|
# KDE connect: 1714-1764
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
networking.firewall.allowedTCPPorts = [ 27015 25565 7777 ] ++ (builtins.genList (x: 1714 + x) (1764 - 1714 + 1));
|
||||||
|
networking.firewall.allowedUDPPorts = (builtins.genList (x: 1714 + x) (1764 - 1714 + 1));
|
||||||
# networking.hostName = "nixmsi";
|
# networking.hostName = "nixmsi";
|
||||||
networking.wireless.iwd.enable = true;
|
networking.wireless.iwd.enable = true;
|
||||||
#networking.networkmanager.enable = true;
|
#networking.networkmanager.enable = true;
|
||||||
|
@ -170,6 +186,7 @@ in {
|
||||||
vim
|
vim
|
||||||
wget
|
wget
|
||||||
git
|
git
|
||||||
|
man-pages man-pages-posix
|
||||||
];
|
];
|
||||||
services.dbus.enable = true;
|
services.dbus.enable = true;
|
||||||
security.polkit.enable = true;
|
security.polkit.enable = true;
|
||||||
|
@ -181,6 +198,12 @@ in {
|
||||||
alsa.support32Bit = true;
|
alsa.support32Bit = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
jack.enable = true;
|
jack.enable = true;
|
||||||
|
# from nix-gaming
|
||||||
|
lowLatency = {
|
||||||
|
enable = true;
|
||||||
|
quantum = 64;
|
||||||
|
rate = 48000;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# zsh
|
# zsh
|
||||||
environment.pathsToLink = [ "/share/zsh" ];
|
environment.pathsToLink = [ "/share/zsh" ];
|
||||||
|
@ -194,6 +217,7 @@ in {
|
||||||
|
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
users.users.user = {
|
users.users.user = {
|
||||||
|
uid = 1000;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
# initialHashedPassword = ...set in private.nix;
|
# initialHashedPassword = ...set in private.nix;
|
||||||
|
@ -215,8 +239,16 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
documentation.dev.enable = true;
|
||||||
|
|
||||||
### RANDOM PATCHES ###
|
### RANDOM PATCHES ###
|
||||||
|
|
||||||
|
# I've had some weird issues with the entire system breaking after
|
||||||
|
# suspend because of /dev/shm getting nuked, maybe this'll help
|
||||||
|
services.logind.extraConfig = ''
|
||||||
|
RemoveIPC=no
|
||||||
|
'';
|
||||||
|
|
||||||
# why is this not part of base NixOS?
|
# why is this not part of base NixOS?
|
||||||
systemd.tmpfiles.rules = [ "d /var/lib/systemd/pstore 0755 root root 14d" ];
|
systemd.tmpfiles.rules = [ "d /var/lib/systemd/pstore 0755 root root 14d" ];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue