nixos-config/hosts/miku.nix

199 lines
4.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-mainwindow
virt-manager qemu scream
replaysorcery # Custom package
vfio-isolate # Custom Package
steam-wrapped discord-wrapped # Custom package
mumble
piper trackma # Custom package
anime-dl # Custom package
thunderbird
#nwg-launchers
gnome-podcasts
cantata
newsflash
sublime-music
anki
#psst
];
ptw = {
programs = {
mpv = {
primaryScreen = "C27F398";
enable = true;
};
sway.enable = true;
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;
#office.enable = true;
#plasma.enable = true;
gaming.enable = true;
};
services = {
gamemode.enable = true;
#gnome.enable = true;
input-remapper = {
enable = true;
postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"";
};
};
system = {
i18n.enable = true;
singleUser = "alexander";
primaryInterface = "enp6s0";
hostName = "miku";
offloading.builder.enable = true;
};
virtualisation = {
enable = true;
gaming.enable = true;
};
};
programs = {
adb.enable = true;
gnupg.agent.pinentryFlavor = "qt";
};
virtualisation = {
#podman = {
# enable = true;
# dockerCompat = true;
#};
};
boot = {
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"
"nopti"
"nospectre_v2"
"nospec"
"clocksource=tsc"
"tsc=reliable"
"pci=noaer"
];
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
#extraModulePackages = [ pkgs.linuxPackages.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 = pkgs.linuxPackages_zen;
};
services = {
ratbagd.enable = true;
flatpak.enable = true;
#etesync-dav.enable = true;
connman.extraConfig = ''
WriteResolvConf=false
'';
xserver = {
enable = true;
layout = "de";
libinput.enable = true;
displayManager.gdm = {
wayland = true;
enable = true;
};
desktopManager.plasma5.enable = true;
};
earlyoom.enable = lib.mkForce false;
};
hardware = {
opentabletdriver.enable = 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";
};
};
};
};
}