nixos-config/hosts/miku.nix

248 lines
5.8 KiB
Nix

{ config, lib, pkgs, inputs, ... }:
{
imports = with inputs.nixos-hardware.nixosModules; [
common-cpu-amd common-gpu-amd common-pc-ssd
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/root";
fsType = "btrfs";
};
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
"/mnt/Storage" = {
device = "/dev/disk/by-label/storage";
fsType = "btrfs";
options = [
"noatime"
"nodev"
"nosuid"
];
};
};
environment.systemPackages = with pkgs; [
gajim
virt-manager qemu scream
replaysorcery # Custom package
vfio-isolate # Custom Package
mumble
piper trackma # Custom package
anime-dl # Custom package
thunderbird
#nwg-launchers
gnome-podcasts
cantata
newsflash
sublime-music
anki
gnome-podcasts
gimp
#psst
evolution
# Proprietary stuff (yikes)
discord-wrapped discord-app-wrapped
spotify-wrapped
zoom-vm
#lapce
];
ptw = {
programs = {
#bluray.enable = true;
mpv = {
primaryScreen = "DP-2";
enable = true;
};
sway.enable = false;
alacritty.enable = true;
emacs.enable = true;
firefox.enable = true;
git.enable = true;
gnome-terminal.enable = true;
tmux.enable = true;
waybar = {
enable = true;
output = "DP-2";
};
#xournalpp.enable = true;
zsh.enable = true;
direnv.enable = true;
office.enable = true;
plasma = {
enable = true;
sddm = {
backgroundImage = pkgs.fetchurl {
url = "https://cdn.donmai.us/original/d3/1b/__manjuu_prinz_eugen_roon_bismarck_friedrich_der_grosse_and_3_more_azur_lane_drawn_by_zaphn__d31bf4ac564d60f8787818842c369e7f.jpg";
sha256 = "sha256-likoJuEaGzGH0RqjPsBE9o5ATwgnOo97PREh3oZBax8=";
};
};
};
gaming.enable = true;
obs.enable = true;
android.enable = true;
};
services = {
gamemode.enable = true;
gnome.enable = false;
logiops.enable = true;
gdm = {
enable = false;
};
};
system = {
i18n.enable = true;
singleUser = "alexander";
primaryInterface = "enp6s0";
hostName = "miku";
offloading.builder.enable = true;
};
virtualisation = {
enable = true;
gaming.enable = false;
};
};
programs = {
adb.enable = true;
gnupg.agent.pinentryFlavor = "qt";
evolution.enable = true;
};
virtualisation = {
#podman = {
# enable = true;
# dockerCompat = true;
#};
docker = {
enable = true;
storageDriver = "btrfs";
};
};
boot = let
kernel = pkgs.linuxPackages_zen;
in {
extraModprobeConfig = ''
options kvm_amd nested=1
options vfio-pci ids=1002:67df,1002:aaf0
'';
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
kernelModules = [
"amdgpu" # GPU (duh)
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
"uinput" # key-mapper
"vendor-reset"
];
};
kernelParams = [
"amd_iommu=on"
"iommu=on"
"sysrq_always_enabled=1"
"kvm.ignore_msrs=1"
"kvm.report_ignored_msrs=N"
"fbcon=rotate:3"
"quiet"
"clocksource=tsc"
"tsc=reliable"
"pci=noaer"
# Disable mitigations
"mitigations=off"
"rhgb"
# Enable ZSwap
"zswap.enabled=1"
# Enable Apparmor
"lsm=landlock,lockdown,yama,integrity,apparmor,bpf"
# Prevent sequential probing
"libahci.ignore_sss=1"
];
kernel.sysctl = {
# League of Legends under Linux
"abi.vsyscall32" = 0;
};
extraModulePackages = [ kernel.vendor-reset ];
# NOTE: A regression appears to have happend between 5.10 and 5.12
# which leads to the RX590 to have the fence fallback timer on
# sdma0 time out (whatever this means). Maybe bisect?
kernelPackages = kernel;
};
services = {
ratbagd.enable = true;
flatpak.enable = true;
#etesync-dav.enable = true;
connman.extraConfig = ''
WriteResolvConf=false
'';
xserver = {
enable = true;
layout = "de";
libinput.enable = true;
};
earlyoom.enable = lib.mkForce false;
udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", ATTR{power/wakeup}="disabled", ATTR{driver/1-7/power/wakeup}="disabled"
'';
};
hardware = {
opentabletdriver.enable = true;
openrazer = {
enable = true;
devicesOffOnScreensaver = true;
users = [ "alexander" ];
};
bluetooth = {
enable = true;
powerOnBoot = true;
};
};
# TODO: Move into modules
/*
systemd = {
services = {
enable-vendor-reset = {
wantedBy = [ "default.target" ];
script = ''
echo "device_specific" > /sys/bus/pci/devices/0000:01:00.0/reset_method
'';
serviceConfig = {
Type = "simple";
};
};
};
user.services = {
replaysorcery-kms = {
description = "An open-source, instant-replay solution for Linux; KMS service";
#wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.replaysorcery}/bin/replay-sorcery kms-service";
Restart = "always";
};
};
replaysorcery = {
description = "An open-source, instant-replay solution for Linux";
#wantedBy = [ "default.target" ];
requires = [ "replaysorcery-kms.service" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.replaysorcery}/bin/replay-sorcery";
Restart = "always";
};
};
};
};
*/
}