miku: Various things
This commit is contained in:
parent
44b9e944c5
commit
1b64ecf4d7
128
hosts/miku.nix
128
hosts/miku.nix
@ -1,4 +1,4 @@
|
||||
{ config, pkgs, modulesPath, lib, ... }:
|
||||
{ config, pkgs, modulesPath, lib, fetchGit, ... }:
|
||||
|
||||
let
|
||||
unstable = (import ../modules/unstable.nix config);
|
||||
@ -6,12 +6,12 @@ let
|
||||
in {
|
||||
imports = [
|
||||
./generic.nix
|
||||
../modules/hardware/generic.nix ../modules/hardware/video.nix
|
||||
../modules/hardware/generic.nix ../modules/hardware/video.nix ../modules/hardware/desktop.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
|
||||
../modules/programs/music
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
@ -20,12 +20,40 @@ in {
|
||||
ref = "master";
|
||||
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
|
||||
}))
|
||||
|
||||
#(import (builtins.fetchTarball {
|
||||
# url = "https://github.com/nix-community/NUR/archive/master.tar.gz";
|
||||
# sha256 = "0r2pcc6sjxmhg1xxk23648wrwccv2c5v44cfwglx35az5y0hmr1f";
|
||||
#}))
|
||||
|
||||
(final: prev:
|
||||
let
|
||||
# NOTE: This is a really messy solution
|
||||
buildFHSUserEnvBubblewrap = prev.callPackage ../packages/build-support/build-fhs-userenv-bubblewrap {};
|
||||
in {
|
||||
steamPackages = prev.steamPackages.override {
|
||||
buildFHSUserEnv = buildFHSUserEnvBubblewrap;
|
||||
# Include gamemode in the FHS
|
||||
#extraPkgs = (pkgs: with pkgs; [ gamemode ]);
|
||||
};
|
||||
|
||||
steam = final.steamPackages.steam-fhsenv.overrideAttrs (old: {
|
||||
specifyHomeDirs = true;
|
||||
chdirTo = "/home/$USER";
|
||||
});
|
||||
steam-run = final.steam.run;
|
||||
steam-run-native = (final.steam.override {
|
||||
nativeOnly = true;
|
||||
});
|
||||
steamcmd = final.steamPackages.steamcmd;
|
||||
})
|
||||
|
||||
customPkgs
|
||||
];
|
||||
|
||||
|
||||
nixpkgs.config.packageOverrides = pkgs: {
|
||||
nur = (import ../modules/nur.nix pkgs);
|
||||
unstable = unstable;
|
||||
nur = (import ../modules/nur.nix pkgs);
|
||||
};
|
||||
|
||||
environment = {
|
||||
@ -33,14 +61,13 @@ in {
|
||||
emacsPgtkGcc
|
||||
unstable.firmwareLinuxNonfree
|
||||
gajim
|
||||
libvirt virt-manager qemu
|
||||
libvirt virt-manager qemu scream
|
||||
gamemode # Custom package
|
||||
key-mapper # Custom package
|
||||
replaysorcery # Custom package
|
||||
evdev-proxy # Custom package
|
||||
scream
|
||||
evdev-proxy # Custom package
|
||||
vfio-isolate # Custom Package
|
||||
steam
|
||||
linuxPackages_zen.vendor-reset
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
@ -73,31 +100,44 @@ in {
|
||||
[[device.Simple.selector]]
|
||||
EVDEVClass = {phys="\"key-mapper\""}
|
||||
'';
|
||||
"libvirt/hooks/qemu" = {
|
||||
source = pkgs.writeText "qemu" ''
|
||||
#!/bin/sh
|
||||
guest=$1
|
||||
phase=$2
|
||||
state=$3
|
||||
what=$4
|
||||
"libvirt/hooks/qemu".source = let
|
||||
vfio-isolate-state = "/tmp/vfio-isolate-state";
|
||||
in pkgs.writeScript "qemu" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
guest=$1
|
||||
action=$2
|
||||
phase=$3
|
||||
extra=$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
|
||||
'';
|
||||
if [[ "$guest" = "win10" ]]; then
|
||||
case "$action" in
|
||||
prepare)
|
||||
# Only do this while in preparation
|
||||
[[ ! "$phase" = "prepare" ]] && exit 0
|
||||
|
||||
mode = "0755";
|
||||
};
|
||||
sudo -u alexander systemctl --user start evdev-proxy.service
|
||||
sudo -u alexander systemctl --user start scream.service
|
||||
sleep 2
|
||||
|
||||
${pkgs.vfio-isolate}/bin/vfio-isolate \
|
||||
-u ${vfio-isolate-state} \
|
||||
cpu-governor performance "$GUEST_CORES" \
|
||||
cpuset-create --cpus "$GUEST_CORES" /guest.slice \
|
||||
cpuset-create --cpus C0,4 /host.slice \
|
||||
move-tasks / /host.slice \
|
||||
irq-affinity mask "$GUEST_CORES"
|
||||
;;
|
||||
stopped)
|
||||
# Only run when the VM is fully stopped
|
||||
[[ ! "$phase" = "end" ]] && exit 0
|
||||
sudo -u alexander systemctl --user stop evdev-proxy.service
|
||||
sudo -u alexander systemctl --user stop scream.service
|
||||
|
||||
${pkgs.vfio-isolate}/bin/vfio-isolate \
|
||||
restore ${vfio-isolate-state}
|
||||
esac
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@ -139,9 +179,11 @@ in {
|
||||
"quiet"
|
||||
];
|
||||
kernelModules = [];
|
||||
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
#kernelPackages = pkgs.linuxPackages_lqx;
|
||||
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 = {
|
||||
@ -177,13 +219,23 @@ in {
|
||||
"/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"
|
||||
"/dev/input/by-id/virtual-event-EvdevProxyMouse",
|
||||
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd"
|
||||
]
|
||||
'';
|
||||
};
|
||||
# NOTE: Workaround for libvirt's SYSCONFDIR being set to /var/lib
|
||||
# (See https://github.com/NixOS/nixpkgs/issues/51152#issuecomment-899374407)
|
||||
system.activationScripts.libvirt-hooks.text = ''
|
||||
ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks
|
||||
'';
|
||||
|
||||
systemd = {
|
||||
services.NetworkManager-wait-online.enable = false;
|
||||
services = {
|
||||
NetworkManager-wait-online.enable = false;
|
||||
libvirtd.path = with pkgs; [ vfio-isolate systemd ];
|
||||
};
|
||||
|
||||
user.services = {
|
||||
scream = {
|
||||
description = "Audio receiver for the Scream virtual network sound card";
|
||||
@ -210,6 +262,8 @@ in {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
|
||||
Restart = "always";
|
||||
# NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset
|
||||
ExecPostStart = "${pkgs.key-mapper}/bin/key-mapper --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
|
||||
};
|
||||
};
|
||||
replaysorcery = {
|
||||
|
Loading…
Reference in New Issue
Block a user