nixos-config/hosts/miku.nix

257 lines
6.5 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";
};
};
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;
extraSessionCommands = ''
# Pick the dGPU as the first one
#DGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:01:00.0/drm | grep card)
#IGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:08:00.0/drm | grep card)
#WLR_DRM_DEVICES=/dev/dri/$DGPU_DRM_NODE:/dev/dri/$IGPU_DRM_NODE
'';
};
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;
greetd = {
enable = true;
/*
swayExtra = ''
output HDMI-A-3 transform 90 anticlockwise
workspace 1 output HDMI-A-3
'';
*/
};
kanshi = let
horizontal = "Samsung Electric Company C27F398 H4ZR101145";
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
helpers = import ../lib/helpers/kanshi.nix;
mkProfile = helpers.mkProfile;
wallpaperScript = helpers.mkWallpaperScript {
inherit pkgs config;
};
in {
enable = true;
profiles = {
homeMultihead = mkProfile {
outputs = [
{
criteria = vertical;
status = "enable";
mode = "1920x1080";
transform = "90";
position = "-1080,0";
}
{
criteria = horizontal;
status = "enable";
mode = "1920x1080";
position = "0,0";
}
];
name = "homeMultihead";
script = wallpaperScript;
};
};
};
swaync.enable = true;
input-remapper = {
enable = true;
postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
};
};
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
options amdgpu dpm=0
'';
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=pt"
"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"
];
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 = 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 = {
scream = {
description = "Audio receiver for the Scream virtual network sound card";
#wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scream}/bin/scream -i virbr0 -o pulse";
Restart = "always";
};
};
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";
};
};
};
};
}