hosts: Improve the passthrough experience
This commit is contained in:
parent
18655bd56c
commit
ed62c46cbd
@ -54,7 +54,7 @@ in
|
||||
};
|
||||
|
||||
# We don't tolerate non-free software, except for Steam and Linux firmware
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "firmwareLinuxNonfree" ];
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "firmwareLinuxNonfree" "steam" "steam-original" "steam-runtime"];
|
||||
|
||||
services = {
|
||||
connman = {
|
||||
|
100
hosts/miku.nix
100
hosts/miku.nix
@ -37,14 +37,68 @@ in {
|
||||
gamemode # Custom package
|
||||
key-mapper # Custom package
|
||||
replaysorcery # Custom package
|
||||
evdev-proxy # Custom package
|
||||
scream
|
||||
steam
|
||||
linuxPackages_zen.vendor-reset
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
# Prevent us from having to always type it out
|
||||
#NIXOS_CONFIG = "\${HOME}/Development/Personal/nixos-config/hosts/miku.nix";
|
||||
};
|
||||
};
|
||||
|
||||
etc = {
|
||||
"evdev-proxy/config.toml".source = pkgs.writeText "config.toml" ''
|
||||
log_level = "INFO"
|
||||
|
||||
[[device]]
|
||||
[device.Simple]
|
||||
name = "EvdevProxyMouse"
|
||||
vendor = 0x1337
|
||||
model = 0x1337
|
||||
class = "Mouse"
|
||||
[[device.Simple.selector]]
|
||||
USBIDClass = {vendor=0x046d, model=0xc531, class="Mouse"}
|
||||
[[device.Simple.selector]]
|
||||
USBIDClass = {vendor=0x046d, model=0xc07c, class="Mouse"}
|
||||
[[device]]
|
||||
[device.Simple]
|
||||
name = "EvdevProxyTartarus"
|
||||
vendor = 0x1337
|
||||
model = 0x1338
|
||||
class = "Mouse"
|
||||
[[device.Simple.selector]]
|
||||
USBIDClass = {vendor=0x1532, model=0x022b, class="Keyboard"}
|
||||
[[device.Simple.selector]]
|
||||
EVDEVClass = {phys="\"key-mapper\""}
|
||||
'';
|
||||
"libvirt/hooks/qemu" = {
|
||||
source = pkgs.writeText "qemu" ''
|
||||
#!/bin/sh
|
||||
guest=$1
|
||||
phase=$2
|
||||
state=$3
|
||||
what=$4
|
||||
|
||||
if [[ "$guest" = "win10" ]]; then
|
||||
case "$phase" in
|
||||
"prepare")
|
||||
sudo -u alexander systemctl --user start evdev-proxy
|
||||
;;
|
||||
"start")
|
||||
sudo -u alexander systemctl --user start scream
|
||||
;;
|
||||
"stopped")
|
||||
sudo -u alexander systemctl --user stop scream
|
||||
sudo -u alexander systemctl --user stop evdev-proxy
|
||||
esac
|
||||
end
|
||||
'';
|
||||
|
||||
mode = "0755";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
@ -98,6 +152,12 @@ in {
|
||||
xserver.videoDrivers = [ "amdgpu" ];
|
||||
udev.extraRules = ''
|
||||
KERNEL=="uinput", GROUP="input"
|
||||
|
||||
# This rule allows the input group to access /dev/uinput device to create virtual input devices
|
||||
KERNEL=="uinput", SUBSYSTEM=="misc", GROUP="input", MODE="660"
|
||||
|
||||
# Create rules for your virtual devices to get persistent names
|
||||
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="EvdevProxy*", SYMLINK+="input/by-id/virtual-event-$attr{name}"
|
||||
'';
|
||||
|
||||
sshd.enable = true;
|
||||
@ -106,18 +166,18 @@ in {
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
qemuOvmf = true;
|
||||
qemuRunAsRoot = false;
|
||||
#qemuRunAsRoot = false;
|
||||
qemuPackage = unstable.qemu;
|
||||
qemuVerbatimConfig = ''
|
||||
user = "alexander"
|
||||
seccomp_sandbox = 0
|
||||
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"
|
||||
"/dev/null", "/dev/full", "/dev/zero",
|
||||
"/dev/random", "/dev/urandom",
|
||||
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
|
||||
"/dev/rtc","/dev/hpet",
|
||||
"/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse",
|
||||
"/dev/input/by-id/usb-Razer_Razer_Tartarus_V2-event-kbd",
|
||||
"/dev/input/by-id/virtual-event-EvdevProxyMouse"
|
||||
]
|
||||
'';
|
||||
};
|
||||
@ -143,6 +203,15 @@ in {
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
key-mapper = {
|
||||
description = "A tool to change the mapping of your input device buttons";
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
replaysorcery = {
|
||||
description = "An open-source, instant-replay solution for Linux";
|
||||
#wantedBy = [ "default.target" ];
|
||||
@ -153,6 +222,15 @@ in {
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
evdev-proxy = {
|
||||
description = "Creates virtual device to proxy evdev devices events";
|
||||
#wantedBy = [ "default.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.evdev-proxy}/bin/evdev-proxy";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
gamemode = {
|
||||
description = "A daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.";
|
||||
wantedBy = [ "default.target" ];
|
||||
|
Loading…
Reference in New Issue
Block a user