nixos-config/hosts/miku.nix
2023-09-17 13:35:43 +02:00

265 lines
6.0 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
anki
gimp
xwaylandvideobridge
#psst
#lapce
];
ptw = {
programs = {
#bluray.enable = true;
mpv = {
primaryScreen = "DP-1";
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";
};
neovim.enable = true;
#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 = {
yubikey.enable = true;
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 = {
docker = {
enable = true;
storageDriver = "btrfs";
};
};
boot = let
kernel = pkgs.linuxPackages_xanmod_latest;
in {
extraModprobeConfig = ''
options kvm_amd nested=1
'';
initrd = {
availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"sd_mod"
"amdgpu"
"vendor-reset"
"winesync"
];
kernelModules = [
"amdgpu" # GPU (duh)
"kvm-amd" /*"vfio_virqfd"*/ "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
"uinput" # key-mapper
"vendor-reset"
"winesync"
];
};
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"
# Make the system less ready to swap
"sysctl.vm.swappiness=0"
];
kernel.sysctl = {
# League of Legends under Linux
"abi.vsyscall32" = 0;
# Fedora 39
"vm.max_map_count" = 2147483642;
};
extraModulePackages = [ kernel.vendor-reset ];
kernelPackages = kernel;
binfmt = {
emulatedSystems = [ "aarch64-linux" ];
registrations.aarch64-linux.fixBinary = true;
};
};
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 = {
openrgb = {
enable = true;
motherboard = "amd";
};
};
system76-scheduler = {
enable = false;
useStockConfig = true;
};
};
programs = {
cdemu = {
enable = true;
gui = true;
};
};
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";
};
};
};
};
*/
}