nixos-config/miku.nix

166 lines
4.8 KiB
Nix

{ config, pkgs, modulesPath, lib, ... }:
let
unstable = (import ./modules/unstable.nix config);
customPkgs = import ./packages/overlay.nix;
gamemode = pkgs.callPackage ./packages/gamemode {};
in {
imports = [
./generic.nix
./modules/hardware/generic.nix ./modules/hardware/video.nix
./modules/fonts.nix
./modules/users/alexander.nix
./modules/programs/zsh ./modules/programs/git ./modules/programs/mpv ./modules/programs/tmux ./modules/programs/emacs ./modules/programs/firefox ./modules/programs/gnome-terminal ./modules/programs/gnome ./modules/programs/i18n.nix ./modules/programs/gamemode ./modules/programs/nonvm
./modules/programs/distributed-build/builder.nix
#./modules/programs/music
];
nixpkgs.overlays = [
(import (builtins.fetchGit {
url = "https://github.com/nix-community/emacs-overlay.git";
ref = "master";
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
}))
customPkgs
];
nixpkgs.config.packageOverrides = pkgs: {
nur = (import ./modules/nur.nix pkgs);
unstable = unstable;
};
environment = {
systemPackages = with pkgs; [
emacsPgtkGcc
unstable.firmwareLinuxNonfree
gajim
libvirt virt-manager qemu
gamemode # Custom package
key-mapper # Custom package
scream
linuxPackages_zen.vendor-reset
];
sessionVariables = {
# Prevent us from having to always type it out
#NIXOS_CONFIG = "\${HOME}/Development/Personal/nixos-config/miku.nix";
};
};
networking = {
interfaces.enp6s0.useDHCP = false;
hostName = "miku";
# Nix otherwise has a conflict with this option
wireless.enable = lib.mkForce false;
# Allow scream to connect to this host
firewall.allowedUDPPorts = [ 4010 ];
};
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
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=pt"
"sysrq_always_enabled=1"
"kvm.ignore_msrs=1"
"kvm.report_ignored_msrs=N"
"fbcon=rotate:1"
"quiet"
];
kernelModules = [];
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
kernelPackages = pkgs.linuxPackages_zen;
};
services = {
# NOTE: key-mapper has a dbus policy file that we need to include
dbus.packages = [ pkgs.key-mapper ];
emacs.package = pkgs.emacsPgtkGcc;
flatpak.enable = true;
xserver.videoDrivers = [ "amdgpu" ];
udev.extraRules = ''
KERNEL=="uinput", GROUP="input"
'';
sshd.enable = true;
};
virtualisation.libvirtd = {
enable = true;
qemuOvmf = true;
qemuRunAsRoot = false;
qemuVerbatimConfig = ''
user = "alexander"
cgroup_device_acl = [
"/dev/null", "/dev/zero", "/dev/full",
"/dev/random", "/dev/kvm", "/dev/kqemu",
"/dev/rtc", "/dev/hpet", "dev/ptmx",
"/dev/input/by-id/usb-Logitech_G700s_Rechargeable_Gaming_Mouse_93DF48160007-event-mouse",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-if01-event-kbd",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-if02-event-mouse",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-if01"
]
'';
};
systemd = {
services.NetworkManager-wait-online.enable = false;
user.services = {
scream = {
enable = false; # Started by the passthrough script
description = "Audio receiver for the Scream virtual network sound card";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scream}/bin/scream -i virbr0 -o pulse";
RestartAlways = "always";
};
};
gamemode = {
enable = true;
description = "A daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${gamemode}/bin/gamemoded";
Restart = "always";
};
};
};
};
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 = "ext4";
};
};
swapDevices = [ ];
}